Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: chrome/browser/extensions/extension_webnavigation_apitest.cc

Issue 9015022: Replace most of Browser::GetSelectedTabContents calls into Browser::GetSelectedWebContents. I've ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
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_list.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/browser/renderer_host/render_view_host.h" 15 #include "content/browser/renderer_host/render_view_host.h"
16 #include "content/browser/tab_contents/tab_contents.h" 16 #include "content/browser/tab_contents/tab_contents.h"
17 #include "net/base/mock_host_resolver.h" 17 #include "net/base/mock_host_resolver.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
20 #include "webkit/glue/context_menu.h" 20 #include "webkit/glue/context_menu.h"
21 21
22 using content::WebContents;
23
22 namespace { 24 namespace {
23 25
24 class TestRenderViewContextMenu : public RenderViewContextMenu { 26 class TestRenderViewContextMenu : public RenderViewContextMenu {
25 public: 27 public:
26 TestRenderViewContextMenu(TabContents* tab_contents, 28 TestRenderViewContextMenu(TabContents* tab_contents,
27 const ContextMenuParams& params) 29 const ContextMenuParams& params)
28 : RenderViewContextMenu(tab_contents, params) { 30 : RenderViewContextMenu(tab_contents, params) {
29 } 31 }
30 virtual ~TestRenderViewContextMenu() {} 32 virtual ~TestRenderViewContextMenu() {}
31 33
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationRequestOpenTab) { 190 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationRequestOpenTab) {
189 FrameNavigationState::set_allow_extension_scheme(true); 191 FrameNavigationState::set_allow_extension_scheme(true);
190 192
191 CommandLine::ForCurrentProcess()->AppendSwitch( 193 CommandLine::ForCurrentProcess()->AppendSwitch(
192 switches::kAllowLegacyExtensionManifests); 194 switches::kAllowLegacyExtensionManifests);
193 195
194 // Wait for the extension to set itself up and return control to us. 196 // Wait for the extension to set itself up and return control to us.
195 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_requestOpenTab.html")) 197 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_requestOpenTab.html"))
196 << message_; 198 << message_;
197 199
198 TabContents* tab = browser()->GetSelectedTabContents(); 200 WebContents* tab = browser()->GetSelectedWebContents();
199 ui_test_utils::WaitForLoadStop(tab); 201 ui_test_utils::WaitForLoadStop(tab);
200 202
201 ResultCatcher catcher; 203 ResultCatcher catcher;
202 204
203 ExtensionService* service = browser()->profile()->GetExtensionService(); 205 ExtensionService* service = browser()->profile()->GetExtensionService();
204 const Extension* extension = 206 const Extension* extension =
205 service->GetExtensionById(last_loaded_extension_id_, false); 207 service->GetExtensionById(last_loaded_extension_id_, false);
206 GURL url = extension->GetResourceURL("requestOpenTab/a.html"); 208 GURL url = extension->GetResourceURL("requestOpenTab/a.html");
207 209
208 ui_test_utils::NavigateToURL(browser(), url); 210 ui_test_utils::NavigateToURL(browser(), url);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; 288 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft;
287 mouse_event.x = 7; 289 mouse_event.x = 7;
288 mouse_event.y = 7; 290 mouse_event.y = 7;
289 mouse_event.clickCount = 1; 291 mouse_event.clickCount = 1;
290 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 292 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
291 mouse_event.type = WebKit::WebInputEvent::MouseUp; 293 mouse_event.type = WebKit::WebInputEvent::MouseUp;
292 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 294 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
293 295
294 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 296 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
295 } 297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698