| 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/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
| 7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
| 8 #include "chrome/browser/extensions/extension_webnavigation_api.h" | 8 #include "chrome/browser/extensions/extension_webnavigation_api.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" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 } | 281 } |
| 282 | 282 |
| 283 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationTargetBlankIncognito) { | 283 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationTargetBlankIncognito) { |
| 284 FrameNavigationState::set_allow_extension_scheme(true); | 284 FrameNavigationState::set_allow_extension_scheme(true); |
| 285 ASSERT_TRUE(StartTestServer()); | 285 ASSERT_TRUE(StartTestServer()); |
| 286 | 286 |
| 287 CommandLine::ForCurrentProcess()->AppendSwitch( | 287 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 288 switches::kAllowLegacyExtensionManifests); | 288 switches::kAllowLegacyExtensionManifests); |
| 289 | 289 |
| 290 // Wait for the extension to set itself up and return control to us. | 290 // Wait for the extension to set itself up and return control to us. |
| 291 ASSERT_TRUE(RunExtensionSubtestIncognito( | 291 ASSERT_TRUE(RunExtensionSubtest( |
| 292 "webnavigation", "test_targetBlank.html")) << message_; | 292 "webnavigation", "test_targetBlank.html", |
| 293 ExtensionApiTest::kFlagEnableIncognito)) << message_; |
| 293 | 294 |
| 294 ResultCatcher catcher; | 295 ResultCatcher catcher; |
| 295 | 296 |
| 296 GURL url = test_server()->GetURL( | 297 GURL url = test_server()->GetURL( |
| 297 "files/extensions/api_test/webnavigation/targetBlank/a.html"); | 298 "files/extensions/api_test/webnavigation/targetBlank/a.html"); |
| 298 | 299 |
| 299 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), url); | 300 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), url); |
| 300 WebContents* tab = BrowserList::FindTabbedBrowser( | 301 WebContents* tab = BrowserList::FindTabbedBrowser( |
| 301 browser()->profile()->GetOffTheRecordProfile(), false)-> | 302 browser()->profile()->GetOffTheRecordProfile(), false)-> |
| 302 GetSelectedWebContents(); | 303 GetSelectedWebContents(); |
| 303 | 304 |
| 304 // There's a link with target=_blank on a.html. Click on it to open it in a | 305 // There's a link with target=_blank on a.html. Click on it to open it in a |
| 305 // new tab. | 306 // new tab. |
| 306 WebKit::WebMouseEvent mouse_event; | 307 WebKit::WebMouseEvent mouse_event; |
| 307 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 308 mouse_event.type = WebKit::WebInputEvent::MouseDown; |
| 308 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; | 309 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; |
| 309 mouse_event.x = 7; | 310 mouse_event.x = 7; |
| 310 mouse_event.y = 7; | 311 mouse_event.y = 7; |
| 311 mouse_event.clickCount = 1; | 312 mouse_event.clickCount = 1; |
| 312 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); | 313 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); |
| 313 mouse_event.type = WebKit::WebInputEvent::MouseUp; | 314 mouse_event.type = WebKit::WebInputEvent::MouseUp; |
| 314 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); | 315 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); |
| 315 | 316 |
| 316 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 317 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 317 } | 318 } |
| OLD | NEW |