| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" | 7 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" |
| 8 #include "extensions/common/error_utils.h" | 8 #include "extensions/common/error_utils.h" |
| 9 #include "extensions/common/feature_switch.h" | 9 #include "extensions/common/feature_switch.h" |
| 10 #include "extensions/common/manifest_constants.h" | 10 #include "extensions/common/manifest_constants.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 // Tests for the options_ui.page manifest field. | 97 // Tests for the options_ui.page manifest field. |
| 98 TEST_F(OptionsPageManifestTest, OptionsUIPage) { | 98 TEST_F(OptionsPageManifestTest, OptionsUIPage) { |
| 99 FeatureSwitch::ScopedOverride enable_flag( | 99 FeatureSwitch::ScopedOverride enable_flag( |
| 100 FeatureSwitch::embedded_extension_options(), true); | 100 FeatureSwitch::embedded_extension_options(), true); |
| 101 | 101 |
| 102 scoped_refptr<Extension> extension = | 102 scoped_refptr<Extension> extension = |
| 103 LoadAndExpectSuccess("options_ui_page_basic.json"); | 103 LoadAndExpectSuccess("options_ui_page_basic.json"); |
| 104 EXPECT_EQ(base::StringPrintf("chrome-extension://%s/options.html", | 104 EXPECT_EQ(base::StringPrintf("chrome-extension://%s/options.html", |
| 105 extension.get()->id().c_str()), | 105 extension->id().c_str()), |
| 106 OptionsPageInfo::GetOptionsPage(extension.get()).spec()); | 106 OptionsPageInfo::GetOptionsPage(extension.get()).spec()); |
| 107 | 107 |
| 108 extension = LoadAndExpectSuccess("options_ui_page_with_legacy_page.json"); | 108 extension = LoadAndExpectSuccess("options_ui_page_with_legacy_page.json"); |
| 109 EXPECT_EQ(base::StringPrintf("chrome-extension://%s/newoptions.html", | 109 EXPECT_EQ(base::StringPrintf("chrome-extension://%s/newoptions.html", |
| 110 extension.get()->id().c_str()), | 110 extension->id().c_str()), |
| 111 OptionsPageInfo::GetOptionsPage(extension.get()).spec()); | 111 OptionsPageInfo::GetOptionsPage(extension.get()).spec()); |
| 112 | 112 |
| 113 Testcase testcases[] = {Testcase("options_ui_page_bad_url.json", | 113 Testcase testcases[] = {Testcase("options_ui_page_bad_url.json", |
| 114 "'page': expected page, got null")}; | 114 "'page': expected page, got null")}; |
| 115 RunTestcases(testcases, arraysize(testcases), EXPECT_TYPE_WARNING); | 115 RunTestcases(testcases, arraysize(testcases), EXPECT_TYPE_WARNING); |
| 116 } | 116 } |
| 117 | 117 |
| 118 // Runs TestOptionsUIChromeStyleAndOpenInTab with and without the | 118 // Runs TestOptionsUIChromeStyleAndOpenInTab with and without the |
| 119 // embedded-extension-options flag. The results should always be the same. | 119 // embedded-extension-options flag. The results should always be the same. |
| 120 TEST_F(OptionsPageManifestTest, OptionsUIChromeStyleAndOpenInTab) { | 120 TEST_F(OptionsPageManifestTest, OptionsUIChromeStyleAndOpenInTab) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 134 ASSERT_FALSE(FeatureSwitch::embedded_extension_options()->IsEnabled()); | 134 ASSERT_FALSE(FeatureSwitch::embedded_extension_options()->IsEnabled()); |
| 135 EXPECT_TRUE(TestOptionsPageChromeStyleAndOpenInTab(true)); | 135 EXPECT_TRUE(TestOptionsPageChromeStyleAndOpenInTab(true)); |
| 136 { | 136 { |
| 137 FeatureSwitch::ScopedOverride enable_flag( | 137 FeatureSwitch::ScopedOverride enable_flag( |
| 138 FeatureSwitch::embedded_extension_options(), true); | 138 FeatureSwitch::embedded_extension_options(), true); |
| 139 EXPECT_TRUE(TestOptionsPageChromeStyleAndOpenInTab(false)); | 139 EXPECT_TRUE(TestOptionsPageChromeStyleAndOpenInTab(false)); |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace | 143 } // namespace |
| OLD | NEW |