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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
11 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 11 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
12 #include "chrome/browser/tab_contents/render_view_context_menu_browsertest_util.
h" | 12 #include "chrome/browser/tab_contents/render_view_context_menu_browsertest_util.
h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_tabstrip.h" | 14 #include "chrome/browser/ui/browser_tabstrip.h" |
15 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
16 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
17 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
18 #include "content/public/browser/navigation_controller.h" | 18 #include "content/public/browser/navigation_controller.h" |
19 #include "content/public/browser/navigation_entry.h" | 19 #include "content/public/browser/navigation_entry.h" |
20 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
21 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
23 #include "content/public/browser/web_contents_view.h" | 23 #include "content/public/browser/web_contents_view.h" |
| 24 #include "content/public/test/browser_test_utils.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
26 | 27 |
27 using content::WebContents; | 28 using content::WebContents; |
28 | 29 |
29 namespace { | 30 namespace { |
30 | 31 |
31 class TestRenderViewContextMenu : public RenderViewContextMenu { | 32 class TestRenderViewContextMenu : public RenderViewContextMenu { |
32 public: | 33 public: |
33 TestRenderViewContextMenu(WebContents* web_contents, | 34 TestRenderViewContextMenu(WebContents* web_contents, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 mouse_event.globalY = 15 + offset.y(); | 124 mouse_event.globalY = 15 + offset.y(); |
124 mouse_event.clickCount = 1; | 125 mouse_event.clickCount = 1; |
125 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); | 126 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); |
126 mouse_event.type = WebKit::WebInputEvent::MouseUp; | 127 mouse_event.type = WebKit::WebInputEvent::MouseUp; |
127 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); | 128 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); |
128 | 129 |
129 // The menu_observer will select "Open in new tab", wait for the new tab to | 130 // The menu_observer will select "Open in new tab", wait for the new tab to |
130 // be added. | 131 // be added. |
131 tab_observer.Wait(); | 132 tab_observer.Wait(); |
132 tab = tab_observer.GetTab(); | 133 tab = tab_observer.GetTab(); |
133 ui_test_utils::WaitForLoadStop(tab); | 134 content::WaitForLoadStop(tab); |
134 | 135 |
135 // Verify that it's the correct tab. | 136 // Verify that it's the correct tab. |
136 EXPECT_EQ(GURL("about:blank"), tab->GetURL()); | 137 EXPECT_EQ(GURL("about:blank"), tab->GetURL()); |
137 } | 138 } |
138 | 139 |
139 } // namespace | 140 } // namespace |
OLD | NEW |