| 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 "base/files/file_path.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
| 8 #include "chrome/test/base/ui_test_utils.h" | 8 #include "chrome/test/base/ui_test_utils.h" |
| 9 #include "extensions/common/feature_switch.h" | 9 #include "extensions/common/feature_switch.h" |
| 10 #include "extensions/common/switches.h" | 10 #include "extensions/common/switches.h" |
| 11 #include "extensions/test/result_catcher.h" | 11 #include "extensions/test/result_catcher.h" |
| 12 | 12 |
| 13 using extensions::Extension; | 13 using extensions::Extension; |
| 14 using extensions::FeatureSwitch; | 14 using extensions::FeatureSwitch; |
| 15 | 15 |
| 16 class ExtensionOptionsApiTest : public ExtensionApiTest { | 16 class ExtensionOptionsApiTest : public ExtensionApiTest { |
| 17 private: | |
| 18 virtual void SetUpCommandLine(CommandLine* command_line) override { | |
| 19 ExtensionApiTest::SetUpCommandLine(command_line); | |
| 20 | |
| 21 enable_options_.reset(new FeatureSwitch::ScopedOverride( | |
| 22 FeatureSwitch::embedded_extension_options(), true)); | |
| 23 // Need to add a command line flag as well as a FeatureSwitch because the | |
| 24 // FeatureSwitch is not copied over to the renderer process from the | |
| 25 // browser process. | |
| 26 command_line->AppendSwitch( | |
| 27 extensions::switches::kEnableEmbeddedExtensionOptions); | |
| 28 } | |
| 29 | |
| 30 scoped_ptr<FeatureSwitch::ScopedOverride> enable_options_; | |
| 31 }; | 17 }; |
| 32 | 18 |
| 33 // crbug/415949. | 19 // crbug/415949. |
| 34 #if defined(OS_MACOSX) | 20 #if defined(OS_MACOSX) |
| 35 #define MAYBE_ExtensionCanEmbedOwnOptions DISABLED_ExtensionCanEmbedOwnOptions | 21 #define MAYBE_ExtensionCanEmbedOwnOptions DISABLED_ExtensionCanEmbedOwnOptions |
| 36 #else | 22 #else |
| 37 #define MAYBE_ExtensionCanEmbedOwnOptions ExtensionCanEmbedOwnOptions | 23 #define MAYBE_ExtensionCanEmbedOwnOptions ExtensionCanEmbedOwnOptions |
| 38 #endif | 24 #endif |
| 39 IN_PROC_BROWSER_TEST_F(ExtensionOptionsApiTest, | 25 IN_PROC_BROWSER_TEST_F(ExtensionOptionsApiTest, |
| 40 MAYBE_ExtensionCanEmbedOwnOptions) { | 26 MAYBE_ExtensionCanEmbedOwnOptions) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 71 } | 57 } |
| 72 | 58 |
| 73 IN_PROC_BROWSER_TEST_F(ExtensionOptionsApiTest, | 59 IN_PROC_BROWSER_TEST_F(ExtensionOptionsApiTest, |
| 74 CannotEmbedUsingInvalidExtensionIds) { | 60 CannotEmbedUsingInvalidExtensionIds) { |
| 75 ASSERT_TRUE(InstallExtension(test_data_dir_.AppendASCII("extension_options") | 61 ASSERT_TRUE(InstallExtension(test_data_dir_.AppendASCII("extension_options") |
| 76 .AppendASCII("embed_invalid"), | 62 .AppendASCII("embed_invalid"), |
| 77 1)); | 63 1)); |
| 78 ASSERT_TRUE( | 64 ASSERT_TRUE( |
| 79 RunExtensionSubtest("extension_options/embed_invalid", "test.html")); | 65 RunExtensionSubtest("extension_options/embed_invalid", "test.html")); |
| 80 } | 66 } |
| OLD | NEW |