Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/files/file_path.h" | |
| 5 #include "chrome/browser/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
| 6 #include "extensions/common/feature_switch.h" | 7 #include "extensions/common/feature_switch.h" |
| 7 #include "extensions/common/switches.h" | 8 #include "extensions/common/switches.h" |
| 8 | 9 |
| 9 using extensions::Extension; | 10 using extensions::Extension; |
| 10 using extensions::FeatureSwitch; | 11 using extensions::FeatureSwitch; |
| 11 | 12 |
| 12 class ExtensionOptionsApiTest : public ExtensionApiTest { | 13 class ExtensionOptionsApiTest : public ExtensionApiTest { |
| 13 private: | 14 private: |
| 14 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 15 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 15 // Need to add a command line flag as well as a FeatureSwitch because the | 16 // Need to add a command line flag as well as a FeatureSwitch because the |
| 16 // FeatureSwitch is not copied over to the renderer process from the | 17 // FeatureSwitch is not copied over to the renderer process from the |
| 17 // browser process. | 18 // browser process. |
| 18 command_line->AppendSwitch( | 19 command_line->AppendSwitch( |
| 19 extensions::switches::kEnableEmbeddedExtensionOptions); | 20 extensions::switches::kEnableEmbeddedExtensionOptions); |
| 20 ExtensionApiTest::SetUpCommandLine(command_line); | 21 ExtensionApiTest::SetUpCommandLine(command_line); |
| 21 } | 22 } |
| 22 }; | 23 }; |
| 23 | 24 |
| 24 IN_PROC_BROWSER_TEST_F(ExtensionOptionsApiTest, ExtensionCanEmbedOwnOptions) { | 25 IN_PROC_BROWSER_TEST_F(ExtensionOptionsApiTest, ExtensionCanEmbedOwnOptions) { |
| 25 FeatureSwitch::ScopedOverride enable_options( | 26 FeatureSwitch::ScopedOverride enable_options( |
| 26 FeatureSwitch::embedded_extension_options(), true); | 27 FeatureSwitch::embedded_extension_options(), true); |
| 27 | 28 |
| 28 const Extension* extension = InstallExtension( | 29 const Extension* extension = InstallExtension( |
| 29 test_data_dir_.AppendASCII("extension_options").AppendASCII("embed_self"), | 30 test_data_dir_.AppendASCII("extension_options").AppendASCII("embed_self"), |
| 30 1); | 31 1); |
| 31 ASSERT_TRUE(extension); | 32 ASSERT_TRUE(extension); |
| 32 ASSERT_TRUE(RunExtensionSubtest("extension_options/embed_self", "test.html")); | 33 ASSERT_TRUE(RunExtensionSubtest("extension_options/embed_self", "test.html")); |
| 33 } | 34 } |
| 35 | |
| 36 IN_PROC_BROWSER_TEST_F(ExtensionOptionsApiTest, | |
| 37 ShouldNotEmbedOtherExtensionsOptions) { | |
| 38 FeatureSwitch::ScopedOverride enable_options( | |
|
not at google - send to devlin
2014/07/30 17:33:10
you might as well make the feature switch a scoped
ericzeng
2014/08/01 17:13:26
Done.
| |
| 39 FeatureSwitch::embedded_extension_options(), true); | |
| 40 base::FilePath dir = test_data_dir_.AppendASCII("extension_options") | |
| 41 .AppendASCII("embed_other"); | |
| 42 | |
| 43 const Extension* embedder = InstallExtension(dir.AppendASCII("embedder"), 1); | |
| 44 const Extension* embedded = InstallExtension(dir.AppendASCII("embedded"), 1); | |
|
not at google - send to devlin
2014/07/30 17:33:10
you don't actually use |embedder| or |embedded| so
ericzeng
2014/08/01 17:13:26
Done.
| |
| 45 | |
| 46 ASSERT_TRUE(embedder); | |
| 47 ASSERT_TRUE(embedded); | |
| 48 | |
| 49 ASSERT_TRUE(RunExtensionSubtest("extension_options/embed_other/embedder", | |
| 50 "test.html")); | |
| 51 } | |
| OLD | NEW |