summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-11 17:46:07 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-11 17:46:07 +0000
commit5039b7a3c5ba113c73ad0aca238c164c67a8805a (patch)
tree6ca9757e7a454a60f258a0b2f55814096307e2e9 /chrome
parent8e7ca37ada1ac495ab24df9ae2cd762a33397826 (diff)
downloadchromium_src-5039b7a3c5ba113c73ad0aca238c164c67a8805a.zip
chromium_src-5039b7a3c5ba113c73ad0aca238c164c67a8805a.tar.gz
chromium_src-5039b7a3c5ba113c73ad0aca238c164c67a8805a.tar.bz2
Support running tests under LayoutTests/http/tests/local as local file, in order to mimic what run-webkit-tests does.
Search "http/tests/local/" in http://trac.webkit.org/browser/trunk/WebKitTools/Scripts/run-webkit-tests for what it does. This is needed by http/tests/local/resources/send-dragged-file.js. Turn on file URL universal access in the test_shell. Delete rebaseline results of those layout tests that pass due to this change. Also add a UI test to make sure it is not on for the browser. BUG=9275,12882 TEST=none Review URL: http://codereview.chromium.org/201048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25985 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_uitest.cc21
-rw-r--r--chrome/test/data/fileurl_universalaccess.html19
2 files changed, 40 insertions, 0 deletions
diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc
index 4c2ed05..a9d93b7 100644
--- a/chrome/browser/browser_uitest.cc
+++ b/chrome/browser/browser_uitest.cc
@@ -236,4 +236,25 @@ TEST_F(ShowModalDialogTest, BasicTest) {
}
#endif
+class SecurityTest : public UITest {
+ protected:
+ static const int kTestIntervalMs = 250;
+ static const int kTestWaitTimeoutMs = 60 * 1000;
+};
+
+TEST_F(SecurityTest, DisallowFileUrlUniversalAccessTest) {
+ scoped_refptr<TabProxy> tab(GetActiveTab());
+ ASSERT_TRUE(tab.get());
+
+ FilePath test_file(test_data_directory_);
+ test_file = test_file.AppendASCII("fileurl_universalaccess.html");
+
+ GURL url = net::FilePathToFileURL(test_file);
+ ASSERT_TRUE(tab->NavigateToURL(url));
+
+ std::string value = WaitUntilCookieNonEmpty(tab.get(), url,
+ "status", kTestIntervalMs, kTestWaitTimeoutMs);
+ ASSERT_STREQ("Disallowed", value.c_str());
+}
+
} // namespace
diff --git a/chrome/test/data/fileurl_universalaccess.html b/chrome/test/data/fileurl_universalaccess.html
new file mode 100644
index 0000000..a419fef
--- /dev/null
+++ b/chrome/test/data/fileurl_universalaccess.html
@@ -0,0 +1,19 @@
+<html>
+<body onload="test();">
+<script>
+function test() {
+ var status;
+ try {
+ var d = frames[0].document.open();
+ status = "Allowed";
+ d.close();
+ } catch (e) {
+ status = "Disallowed";
+ }
+ document.cookie = "status=" + status;
+}
+</script>
+<div id=result></div>
+<iframe src="data:text/html,"></iframe>
+</body>
+</html> \ No newline at end of file