Index: chrome/browser/guest_view/extension_options/extension_options_apitest.cc |
diff --git a/chrome/browser/guest_view/extension_options/extension_options_apitest.cc b/chrome/browser/guest_view/extension_options/extension_options_apitest.cc |
index af96f02598a0da2fbf0b011631a3e1afb3cbc170..80e390fdfcff73812604d73d4a2f0d0f8558dc34 100644 |
--- a/chrome/browser/guest_view/extension_options/extension_options_apitest.cc |
+++ b/chrome/browser/guest_view/extension_options/extension_options_apitest.cc |
@@ -2,7 +2,9 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "base/files/file_path.h" |
#include "chrome/browser/extensions/extension_apitest.h" |
+#include "chrome/test/base/ui_test_utils.h" |
#include "extensions/common/feature_switch.h" |
#include "extensions/common/switches.h" |
@@ -12,6 +14,8 @@ using extensions::FeatureSwitch; |
class ExtensionOptionsApiTest : public ExtensionApiTest { |
private: |
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
+ enable_options_.reset(new FeatureSwitch::ScopedOverride( |
+ FeatureSwitch::embedded_extension_options(), true)); |
// Need to add a command line flag as well as a FeatureSwitch because the |
// FeatureSwitch is not copied over to the renderer process from the |
// browser process. |
@@ -19,15 +23,39 @@ class ExtensionOptionsApiTest : public ExtensionApiTest { |
extensions::switches::kEnableEmbeddedExtensionOptions); |
ExtensionApiTest::SetUpCommandLine(command_line); |
not at google - send to devlin
2014/08/04 19:12:03
ideally call the superclass SetUpCommandLine first
ericzeng
2014/08/04 21:15:33
Done.
|
} |
+ |
+ scoped_ptr<FeatureSwitch::ScopedOverride> enable_options_; |
}; |
IN_PROC_BROWSER_TEST_F(ExtensionOptionsApiTest, ExtensionCanEmbedOwnOptions) { |
+ base::FilePath extension_dir = |
+ test_data_dir_.AppendASCII("extension_options").AppendASCII("embed_self"); |
+ ASSERT_TRUE(InstallExtension(extension_dir, 1)); |
+ ASSERT_TRUE(RunExtensionSubtest("extension_options/embed_self", "test.html")); |
+} |
+ |
+IN_PROC_BROWSER_TEST_F(ExtensionOptionsApiTest, |
+ ShouldNotEmbedOtherExtensionsOptions) { |
FeatureSwitch::ScopedOverride enable_options( |
FeatureSwitch::embedded_extension_options(), true); |
+ base::FilePath dir = test_data_dir_.AppendASCII("extension_options") |
+ .AppendASCII("embed_other"); |
- const Extension* extension = InstallExtension( |
- test_data_dir_.AppendASCII("extension_options").AppendASCII("embed_self"), |
- 1); |
- ASSERT_TRUE(extension); |
- ASSERT_TRUE(RunExtensionSubtest("extension_options/embed_self", "test.html")); |
+ const Extension* embedder = InstallExtension(dir.AppendASCII("embedder"), 1); |
+ const Extension* embedded = InstallExtension(dir.AppendASCII("embedded"), 1); |
+ |
+ ASSERT_TRUE(embedder); |
+ ASSERT_TRUE(embedded); |
+ |
+ std::stringstream script; |
not at google - send to devlin
2014/08/04 19:12:03
don't use stringstream. It's just as easy to const
ericzeng
2014/08/04 21:15:33
Done.
|
+ script << "chrome.storage.local.set(" |
+ << "{'embeddedId': '" << embedded->id() << "'}, function() {" |
+ << "window.domAutomationController.send('done injecting');" |
+ << "});"; |
+ |
+ ExecuteScriptInBackgroundPage(embedder->id(), script.str()); |
+ ResultCatcher catcher; |
+ ui_test_utils::NavigateToURL(browser(), |
+ embedder->GetResourceURL("test.html")); |
+ ASSERT_TRUE(catcher.GetNextResult()); |
} |