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/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
12 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
13 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
14 #include "content/public/browser/render_frame_host.h" | 14 #include "content/public/browser/render_frame_host.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "content/public/test/browser_test_utils.h" | 16 #include "content/public/test/browser_test_utils.h" |
17 #include "extensions/browser/event_router.h" | 17 #include "extensions/browser/event_router.h" |
18 #include "extensions/common/api/test.h" | 18 #include "extensions/common/api/test.h" |
19 #include "extensions/common/extension.h" | 19 #include "extensions/common/extension.h" |
20 #include "extensions/common/feature_switch.h" | |
21 #include "extensions/common/switches.h" | 20 #include "extensions/common/switches.h" |
22 #include "extensions/test/extension_test_message_listener.h" | 21 #include "extensions/test/extension_test_message_listener.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
24 | 23 |
25 namespace extensions { | 24 namespace extensions { |
26 | 25 |
27 namespace OnMessage = core_api::test::OnMessage; | 26 namespace OnMessage = core_api::test::OnMessage; |
28 | 27 |
29 namespace { | 28 namespace { |
30 | 29 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 119 |
121 if (active_web_contents->GetLastCommittedURL() == frame_url) | 120 if (active_web_contents->GetLastCommittedURL() == frame_url) |
122 return active_web_contents->GetMainFrame(); | 121 return active_web_contents->GetMainFrame(); |
123 | 122 |
124 content::RenderFrameHost* frame_host = NULL; | 123 content::RenderFrameHost* frame_host = NULL; |
125 active_web_contents->ForEachFrame( | 124 active_web_contents->ForEachFrame( |
126 base::Bind(&FindFrame, frame_url, &frame_host)); | 125 base::Bind(&FindFrame, frame_url, &frame_host)); |
127 return frame_host; | 126 return frame_host; |
128 } | 127 } |
129 | 128 |
130 virtual void SetUpCommandLine(CommandLine* command_line) override { | |
131 FeatureSwitch::ScopedOverride enable_options( | |
132 FeatureSwitch::embedded_extension_options(), true); | |
133 // Need to add a command line flag as well as a FeatureSwitch because the | |
134 // FeatureSwitch is not copied over to the renderer process from the | |
135 // browser process. | |
136 command_line->AppendSwitch(switches::kEnableEmbeddedExtensionOptions); | |
137 ExtensionApiTest::SetUpCommandLine(command_line); | |
138 } | |
139 | |
140 scoped_ptr<FeatureSwitch::ScopedOverride> enable_options_; | 129 scoped_ptr<FeatureSwitch::ScopedOverride> enable_options_; |
141 }; | 130 }; |
142 | 131 |
143 IN_PROC_BROWSER_TEST_F(ExtensionWebUITest, SanityCheckAvailableAPIsInFrame) { | 132 IN_PROC_BROWSER_TEST_F(ExtensionWebUITest, SanityCheckAvailableAPIsInFrame) { |
144 ASSERT_TRUE(RunTestOnExtensionsFrame("sanity_check_available_apis.js")); | 133 ASSERT_TRUE(RunTestOnExtensionsFrame("sanity_check_available_apis.js")); |
145 } | 134 } |
146 | 135 |
147 IN_PROC_BROWSER_TEST_F(ExtensionWebUITest, | 136 IN_PROC_BROWSER_TEST_F(ExtensionWebUITest, |
148 SanityCheckAvailableAPIsInChromeFrame) { | 137 SanityCheckAvailableAPIsInChromeFrame) { |
149 ASSERT_TRUE(RunTestOnChromeExtensionsFrame("sanity_check_available_apis.js")); | 138 ASSERT_TRUE(RunTestOnChromeExtensionsFrame("sanity_check_available_apis.js")); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 226 |
238 ASSERT_TRUE(listener->WaitUntilSatisfied()); | 227 ASSERT_TRUE(listener->WaitUntilSatisfied()); |
239 listener->Reply(extension->id()); | 228 listener->Reply(extension->id()); |
240 listener.reset(new ExtensionTestMessageListener("onclose received", false)); | 229 listener.reset(new ExtensionTestMessageListener("onclose received", false)); |
241 ASSERT_TRUE(listener->WaitUntilSatisfied()); | 230 ASSERT_TRUE(listener->WaitUntilSatisfied()); |
242 } | 231 } |
243 | 232 |
244 } // namespace | 233 } // namespace |
245 | 234 |
246 } // namespace extensions | 235 } // namespace extensions |
OLD | NEW |