| 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_list.h" | 12 #include "chrome/browser/ui/browser_finder.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 "net/base/mock_host_resolver.h" | 18 #include "net/base/mock_host_resolver.h" |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 21 | 21 |
| 22 using content::WebContents; | 22 using content::WebContents; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 ASSERT_TRUE(RunExtensionSubtest( | 295 ASSERT_TRUE(RunExtensionSubtest( |
| 296 "webnavigation", "test_targetBlank.html", | 296 "webnavigation", "test_targetBlank.html", |
| 297 ExtensionApiTest::kFlagEnableIncognito)) << message_; | 297 ExtensionApiTest::kFlagEnableIncognito)) << message_; |
| 298 | 298 |
| 299 ResultCatcher catcher; | 299 ResultCatcher catcher; |
| 300 | 300 |
| 301 GURL url = test_server()->GetURL( | 301 GURL url = test_server()->GetURL( |
| 302 "files/extensions/api_test/webnavigation/targetBlank/a.html"); | 302 "files/extensions/api_test/webnavigation/targetBlank/a.html"); |
| 303 | 303 |
| 304 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), url); | 304 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), url); |
| 305 WebContents* tab = BrowserList::FindTabbedBrowser( | 305 WebContents* tab = browser::FindTabbedBrowser( |
| 306 browser()->profile()->GetOffTheRecordProfile(), false)-> | 306 browser()->profile()->GetOffTheRecordProfile(), false)-> |
| 307 GetSelectedWebContents(); | 307 GetSelectedWebContents(); |
| 308 | 308 |
| 309 // There's a link with target=_blank on a.html. Click on it to open it in a | 309 // There's a link with target=_blank on a.html. Click on it to open it in a |
| 310 // new tab. | 310 // new tab. |
| 311 WebKit::WebMouseEvent mouse_event; | 311 WebKit::WebMouseEvent mouse_event; |
| 312 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 312 mouse_event.type = WebKit::WebInputEvent::MouseDown; |
| 313 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; | 313 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; |
| 314 mouse_event.x = 7; | 314 mouse_event.x = 7; |
| 315 mouse_event.y = 7; | 315 mouse_event.y = 7; |
| 316 mouse_event.clickCount = 1; | 316 mouse_event.clickCount = 1; |
| 317 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); | 317 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); |
| 318 mouse_event.type = WebKit::WebInputEvent::MouseUp; | 318 mouse_event.type = WebKit::WebInputEvent::MouseUp; |
| 319 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); | 319 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); |
| 320 | 320 |
| 321 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 321 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 322 } | 322 } |
| 323 | 323 |
| 324 } // namespace extensions | 324 } // namespace extensions |
| OLD | NEW |