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/tab_contents/render_view_context_menu_browsertest.cc

Issue 63273002: Rename WebKit namespace to blink (part 4) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 <string> 5 #include <string>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 18 matching lines...) Expand all
29 using content::WebContents; 29 using content::WebContents;
30 30
31 namespace { 31 namespace {
32 32
33 class ContextMenuBrowserTest : public InProcessBrowserTest { 33 class ContextMenuBrowserTest : public InProcessBrowserTest {
34 public: 34 public:
35 ContextMenuBrowserTest() { } 35 ContextMenuBrowserTest() { }
36 36
37 TestRenderViewContextMenu* CreateContextMenu(GURL unfiltered_url, GURL url) { 37 TestRenderViewContextMenu* CreateContextMenu(GURL unfiltered_url, GURL url) {
38 content::ContextMenuParams params; 38 content::ContextMenuParams params;
39 params.media_type = WebKit::WebContextMenuData::MediaTypeNone; 39 params.media_type = blink::WebContextMenuData::MediaTypeNone;
40 params.unfiltered_link_url = unfiltered_url; 40 params.unfiltered_link_url = unfiltered_url;
41 params.link_url = url; 41 params.link_url = url;
42 WebContents* web_contents = 42 WebContents* web_contents =
43 browser()->tab_strip_model()->GetActiveWebContents(); 43 browser()->tab_strip_model()->GetActiveWebContents();
44 params.page_url = web_contents->GetController().GetActiveEntry()->GetURL(); 44 params.page_url = web_contents->GetController().GetActiveEntry()->GetURL();
45 #if defined(OS_MACOSX) 45 #if defined(OS_MACOSX)
46 params.writing_direction_default = 0; 46 params.writing_direction_default = 0;
47 params.writing_direction_left_to_right = 0; 47 params.writing_direction_left_to_right = 0;
48 params.writing_direction_right_to_left = 0; 48 params.writing_direction_right_to_left = 0;
49 #endif // OS_MACOSX 49 #endif // OS_MACOSX
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 ContextMenuNotificationObserver menu_observer( 88 ContextMenuNotificationObserver menu_observer(
89 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); 89 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB);
90 ui_test_utils::WindowedTabAddedNotificationObserver tab_observer( 90 ui_test_utils::WindowedTabAddedNotificationObserver tab_observer(
91 content::NotificationService::AllSources()); 91 content::NotificationService::AllSources());
92 92
93 // Go to a page with a link 93 // Go to a page with a link
94 ui_test_utils::NavigateToURL( 94 ui_test_utils::NavigateToURL(
95 browser(), GURL("data:text/html,<a href='about:blank'>link</a>")); 95 browser(), GURL("data:text/html,<a href='about:blank'>link</a>"));
96 96
97 // Open a context menu. 97 // Open a context menu.
98 WebKit::WebMouseEvent mouse_event; 98 blink::WebMouseEvent mouse_event;
99 mouse_event.type = WebKit::WebInputEvent::MouseDown; 99 mouse_event.type = blink::WebInputEvent::MouseDown;
100 mouse_event.button = WebKit::WebMouseEvent::ButtonRight; 100 mouse_event.button = blink::WebMouseEvent::ButtonRight;
101 mouse_event.x = 15; 101 mouse_event.x = 15;
102 mouse_event.y = 15; 102 mouse_event.y = 15;
103 gfx::Rect offset; 103 gfx::Rect offset;
104 content::WebContents* tab = 104 content::WebContents* tab =
105 browser()->tab_strip_model()->GetActiveWebContents(); 105 browser()->tab_strip_model()->GetActiveWebContents();
106 tab->GetView()->GetContainerBounds(&offset); 106 tab->GetView()->GetContainerBounds(&offset);
107 mouse_event.globalX = 15 + offset.x(); 107 mouse_event.globalX = 15 + offset.x();
108 mouse_event.globalY = 15 + offset.y(); 108 mouse_event.globalY = 15 + offset.y();
109 mouse_event.clickCount = 1; 109 mouse_event.clickCount = 1;
110 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 110 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
111 mouse_event.type = WebKit::WebInputEvent::MouseUp; 111 mouse_event.type = blink::WebInputEvent::MouseUp;
112 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 112 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
113 113
114 // The menu_observer will select "Open in new tab", wait for the new tab to 114 // The menu_observer will select "Open in new tab", wait for the new tab to
115 // be added. 115 // be added.
116 tab_observer.Wait(); 116 tab_observer.Wait();
117 tab = tab_observer.GetTab(); 117 tab = tab_observer.GetTab();
118 content::WaitForLoadStop(tab); 118 content::WaitForLoadStop(tab);
119 119
120 // Verify that it's the correct tab. 120 // Verify that it's the correct tab.
121 EXPECT_EQ(GURL("about:blank"), tab->GetURL()); 121 EXPECT_EQ(GURL("about:blank"), tab->GetURL());
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // Verify that the referrer on the page matches |kEmptyReferrer|. 218 // Verify that the referrer on the page matches |kEmptyReferrer|.
219 std::string page_referrer; 219 std::string page_referrer;
220 ASSERT_TRUE(content::ExecuteScriptAndExtractString( 220 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
221 tab, 221 tab,
222 "window.domAutomationController.send(window.document.referrer);", 222 "window.domAutomationController.send(window.document.referrer);",
223 &page_referrer)); 223 &page_referrer));
224 ASSERT_EQ(kEmptyReferrer, page_referrer); 224 ASSERT_EQ(kEmptyReferrer, page_referrer);
225 } 225 }
226 226
227 } // namespace 227 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698