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 "chrome/app/chrome_command_ids.h" | 5 #include "chrome/app/chrome_command_ids.h" |
6 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" | 6 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 10 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_tabstrip.h" | 12 #include "chrome/browser/ui/browser_tabstrip.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
15 #include "content/public/browser/render_view_host.h" | 15 #include "content/public/browser/render_view_host.h" |
16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
17 #include "content/public/common/context_menu_params.h" | 17 #include "content/public/common/context_menu_params.h" |
| 18 #include "content/public/test/browser_test_utils.h" |
18 #include "net/base/mock_host_resolver.h" | 19 #include "net/base/mock_host_resolver.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
21 | 22 |
22 using content::WebContents; | 23 using content::WebContents; |
23 | 24 |
24 namespace extensions { | 25 namespace extensions { |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 FrameNavigationState::set_allow_extension_scheme(true); | 166 FrameNavigationState::set_allow_extension_scheme(true); |
166 | 167 |
167 CommandLine::ForCurrentProcess()->AppendSwitch( | 168 CommandLine::ForCurrentProcess()->AppendSwitch( |
168 switches::kAllowLegacyExtensionManifests); | 169 switches::kAllowLegacyExtensionManifests); |
169 | 170 |
170 // Wait for the extension to set itself up and return control to us. | 171 // Wait for the extension to set itself up and return control to us. |
171 ASSERT_TRUE( | 172 ASSERT_TRUE( |
172 RunExtensionSubtest("webnavigation", "test_userAction.html")) << message_; | 173 RunExtensionSubtest("webnavigation", "test_userAction.html")) << message_; |
173 | 174 |
174 WebContents* tab = chrome::GetActiveWebContents(browser()); | 175 WebContents* tab = chrome::GetActiveWebContents(browser()); |
175 ui_test_utils::WaitForLoadStop(tab); | 176 content::WaitForLoadStop(tab); |
176 | 177 |
177 ResultCatcher catcher; | 178 ResultCatcher catcher; |
178 | 179 |
179 ExtensionService* service = browser()->profile()->GetExtensionService(); | 180 ExtensionService* service = browser()->profile()->GetExtensionService(); |
180 const extensions::Extension* extension = | 181 const extensions::Extension* extension = |
181 service->GetExtensionById(last_loaded_extension_id_, false); | 182 service->GetExtensionById(last_loaded_extension_id_, false); |
182 GURL url = extension->GetResourceURL("userAction/a.html"); | 183 GURL url = extension->GetResourceURL("userAction/a.html"); |
183 | 184 |
184 ui_test_utils::NavigateToURL(browser(), url); | 185 ui_test_utils::NavigateToURL(browser(), url); |
185 | 186 |
(...skipping 17 matching lines...) Expand all Loading... |
203 FrameNavigationState::set_allow_extension_scheme(true); | 204 FrameNavigationState::set_allow_extension_scheme(true); |
204 | 205 |
205 CommandLine::ForCurrentProcess()->AppendSwitch( | 206 CommandLine::ForCurrentProcess()->AppendSwitch( |
206 switches::kAllowLegacyExtensionManifests); | 207 switches::kAllowLegacyExtensionManifests); |
207 | 208 |
208 // Wait for the extension to set itself up and return control to us. | 209 // Wait for the extension to set itself up and return control to us. |
209 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_requestOpenTab.html")) | 210 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_requestOpenTab.html")) |
210 << message_; | 211 << message_; |
211 | 212 |
212 WebContents* tab = chrome::GetActiveWebContents(browser()); | 213 WebContents* tab = chrome::GetActiveWebContents(browser()); |
213 ui_test_utils::WaitForLoadStop(tab); | 214 content::WaitForLoadStop(tab); |
214 | 215 |
215 ResultCatcher catcher; | 216 ResultCatcher catcher; |
216 | 217 |
217 ExtensionService* service = browser()->profile()->GetExtensionService(); | 218 ExtensionService* service = browser()->profile()->GetExtensionService(); |
218 const extensions::Extension* extension = | 219 const extensions::Extension* extension = |
219 service->GetExtensionById(last_loaded_extension_id_, false); | 220 service->GetExtensionById(last_loaded_extension_id_, false); |
220 GURL url = extension->GetResourceURL("requestOpenTab/a.html"); | 221 GURL url = extension->GetResourceURL("requestOpenTab/a.html"); |
221 | 222 |
222 ui_test_utils::NavigateToURL(browser(), url); | 223 ui_test_utils::NavigateToURL(browser(), url); |
223 | 224 |
(...skipping 16 matching lines...) Expand all Loading... |
240 ASSERT_TRUE(StartTestServer()); | 241 ASSERT_TRUE(StartTestServer()); |
241 | 242 |
242 CommandLine::ForCurrentProcess()->AppendSwitch( | 243 CommandLine::ForCurrentProcess()->AppendSwitch( |
243 switches::kAllowLegacyExtensionManifests); | 244 switches::kAllowLegacyExtensionManifests); |
244 | 245 |
245 // Wait for the extension to set itself up and return control to us. | 246 // Wait for the extension to set itself up and return control to us. |
246 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_targetBlank.html")) | 247 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_targetBlank.html")) |
247 << message_; | 248 << message_; |
248 | 249 |
249 WebContents* tab = chrome::GetActiveWebContents(browser()); | 250 WebContents* tab = chrome::GetActiveWebContents(browser()); |
250 ui_test_utils::WaitForLoadStop(tab); | 251 content::WaitForLoadStop(tab); |
251 | 252 |
252 ResultCatcher catcher; | 253 ResultCatcher catcher; |
253 | 254 |
254 GURL url = test_server()->GetURL( | 255 GURL url = test_server()->GetURL( |
255 "files/extensions/api_test/webnavigation/targetBlank/a.html"); | 256 "files/extensions/api_test/webnavigation/targetBlank/a.html"); |
256 | 257 |
257 chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_LINK); | 258 chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_LINK); |
258 ui_test_utils::NavigateToURL(¶ms); | 259 ui_test_utils::NavigateToURL(¶ms); |
259 | 260 |
260 // There's a link with target=_blank on a.html. Click on it to open it in a | 261 // There's a link with target=_blank on a.html. Click on it to open it in a |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 314 |
314 CommandLine::ForCurrentProcess()->AppendSwitch( | 315 CommandLine::ForCurrentProcess()->AppendSwitch( |
315 switches::kAllowLegacyExtensionManifests); | 316 switches::kAllowLegacyExtensionManifests); |
316 | 317 |
317 ASSERT_TRUE( | 318 ASSERT_TRUE( |
318 RunExtensionSubtest("webnavigation", "test_history.html")) | 319 RunExtensionSubtest("webnavigation", "test_history.html")) |
319 << message_; | 320 << message_; |
320 } | 321 } |
321 | 322 |
322 } // namespace extensions | 323 } // namespace extensions |
OLD | NEW |