summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-26 19:40:29 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-26 19:40:29 +0000
commit3c8bd9f45bfeb09acc2fbad3407e7b2c14d7c7be (patch)
treea4e06819ca0c59659ff8d4538c51bdbfd18e0873 /chrome/test
parent096d5cdd6c7b6930ca4a59bb965b5e4f6647f8e0 (diff)
downloadchromium_src-3c8bd9f45bfeb09acc2fbad3407e7b2c14d7c7be.zip
chromium_src-3c8bd9f45bfeb09acc2fbad3407e7b2c14d7c7be.tar.gz
chromium_src-3c8bd9f45bfeb09acc2fbad3407e7b2c14d7c7be.tar.bz2
Expose whether we're in private browsing mode to plugins.I chose to implement this for multi-process mode only and not --single-process or --in-process-plugins, since I wanted to send this data from the browser process, not the renderer (in case it's exploited).
BUG=158 Review URL: http://codereview.chromium.org/52037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12588 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/data/npapi/private.html25
-rw-r--r--chrome/test/ui/npapi_test_helper.cc8
-rw-r--r--chrome/test/ui/npapi_test_helper.h6
-rw-r--r--chrome/test/ui/npapi_uitest.cpp24
4 files changed, 61 insertions, 2 deletions
diff --git a/chrome/test/data/npapi/private.html b/chrome/test/data/npapi/private.html
new file mode 100644
index 0000000..46cacde
--- /dev/null
+++ b/chrome/test/data/npapi/private.html
@@ -0,0 +1,25 @@
+<html>
+
+<head>
+<script src="npapi.js"></script>
+</head>
+
+
+<body>
+<div id="statusPanel" style="border: 1px solid red; width: 100%">
+Test running....
+</div>
+
+
+NPAPI Private Mode test<p>
+Tests that a plugin can query the private browsing mode.<P>
+
+<embed type="application/vnd.npapi-test"
+ src="foo"
+ name="private"
+ id="1"
+ mode="np_embed"
+>
+
+</body>
+</html>
diff --git a/chrome/test/ui/npapi_test_helper.cc b/chrome/test/ui/npapi_test_helper.cc
index c6753d0..859d3df 100644
--- a/chrome/test/ui/npapi_test_helper.cc
+++ b/chrome/test/ui/npapi_test_helper.cc
@@ -31,6 +31,8 @@
#include "chrome/test/ui/npapi_test_helper.h"
+#include "chrome/common/chrome_switches.h"
+
NPAPITester::NPAPITester()
: UITest() {
}
@@ -59,3 +61,9 @@ void NPAPIVisiblePluginTester::SetUp() {
show_window_ = true;
NPAPITester::SetUp();
}
+
+// NPAPIIncognitoTester members.
+void NPAPIIncognitoTester::SetUp() {
+ launch_arguments_.AppendSwitch(switches::kIncognito);
+ NPAPITester::SetUp();
+}
diff --git a/chrome/test/ui/npapi_test_helper.h b/chrome/test/ui/npapi_test_helper.h
index 26f4c67..7b79e0e 100644
--- a/chrome/test/ui/npapi_test_helper.h
+++ b/chrome/test/ui/npapi_test_helper.h
@@ -46,3 +46,9 @@ class NPAPIVisiblePluginTester : public NPAPITester {
protected:
virtual void SetUp();
};
+
+// Helper class for NPAPI plugin UI tests which use incognito mode.
+class NPAPIIncognitoTester : public NPAPITester {
+ protected:
+ virtual void SetUp();
+};
diff --git a/chrome/test/ui/npapi_uitest.cpp b/chrome/test/ui/npapi_uitest.cpp
index 8d808be..7826878 100644
--- a/chrome/test/ui/npapi_uitest.cpp
+++ b/chrome/test/ui/npapi_uitest.cpp
@@ -76,7 +76,6 @@ TEST_F(NPAPITester, Arguments) {
kTestCompleteSuccess, kShortWaitTimeout);
}
-
// Test invoking many plugins within a single page.
TEST_F(NPAPITester, ManyPlugins) {
std::wstring test_case = L"many_plugins.html";
@@ -134,7 +133,6 @@ TEST_F(NPAPITester, GetJavaScriptURL) {
kTestCompleteSuccess, kShortWaitTimeout);
}
-
// Tests that if an NPObject is proxies back to its original process, the
// original pointer is returned and not a proxy. If this fails the plugin
// will crash.
@@ -261,3 +259,25 @@ TEST_F(NPAPIVisiblePluginTester, OpenPopupWindowWithPlugin) {
kTestCompleteCookie, kTestCompleteSuccess,
action_timeout_ms());
}
+
+// Test checking the privacy mode is off.
+TEST_F(NPAPITester, PrivateDisabled) {
+ if (UITest::in_process_renderer())
+ return;
+
+ GURL url = GetTestUrl(L"npapi", L"private.html");
+ NavigateToURL(url);
+ WaitForFinish("private", "1", url, kTestCompleteCookie,
+ kTestCompleteSuccess, kShortWaitTimeout);
+}
+
+// Test checking the privacy mode is on.
+TEST_F(NPAPIIncognitoTester, PrivateEnabled) {
+ if (UITest::in_process_renderer())
+ return;
+
+ GURL url = GetTestUrl(L"npapi", L"private.html?secure");
+ NavigateToURL(url);
+ WaitForFinish("private", "1", url, kTestCompleteCookie,
+ kTestCompleteSuccess, kShortWaitTimeout);
+}