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" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // Wait for the extension to set itself up and return control to us. | 182 // Wait for the extension to set itself up and return control to us. |
183 ASSERT_TRUE( | 183 ASSERT_TRUE( |
184 RunExtensionSubtest("webnavigation", "test_userAction.html")) << message_; | 184 RunExtensionSubtest("webnavigation", "test_userAction.html")) << message_; |
185 | 185 |
186 WebContents* tab = browser()->GetSelectedWebContents(); | 186 WebContents* tab = browser()->GetSelectedWebContents(); |
187 ui_test_utils::WaitForLoadStop(tab); | 187 ui_test_utils::WaitForLoadStop(tab); |
188 | 188 |
189 ResultCatcher catcher; | 189 ResultCatcher catcher; |
190 | 190 |
191 ExtensionService* service = browser()->profile()->GetExtensionService(); | 191 ExtensionService* service = browser()->profile()->GetExtensionService(); |
192 const Extension* extension = | 192 const extensions::Extension* extension = |
193 service->GetExtensionById(last_loaded_extension_id_, false); | 193 service->GetExtensionById(last_loaded_extension_id_, false); |
194 GURL url = extension->GetResourceURL("userAction/a.html"); | 194 GURL url = extension->GetResourceURL("userAction/a.html"); |
195 | 195 |
196 ui_test_utils::NavigateToURL(browser(), url); | 196 ui_test_utils::NavigateToURL(browser(), url); |
197 | 197 |
198 // This corresponds to "Open link in new tab". | 198 // This corresponds to "Open link in new tab". |
199 content::ContextMenuParams params; | 199 content::ContextMenuParams params; |
200 params.is_editable = false; | 200 params.is_editable = false; |
201 params.media_type = WebKit::WebContextMenuData::MediaTypeNone; | 201 params.media_type = WebKit::WebContextMenuData::MediaTypeNone; |
202 params.page_url = url; | 202 params.page_url = url; |
(...skipping 17 matching lines...) Expand all Loading... |
220 // Wait for the extension to set itself up and return control to us. | 220 // Wait for the extension to set itself up and return control to us. |
221 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_requestOpenTab.html")) | 221 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_requestOpenTab.html")) |
222 << message_; | 222 << message_; |
223 | 223 |
224 WebContents* tab = browser()->GetSelectedWebContents(); | 224 WebContents* tab = browser()->GetSelectedWebContents(); |
225 ui_test_utils::WaitForLoadStop(tab); | 225 ui_test_utils::WaitForLoadStop(tab); |
226 | 226 |
227 ResultCatcher catcher; | 227 ResultCatcher catcher; |
228 | 228 |
229 ExtensionService* service = browser()->profile()->GetExtensionService(); | 229 ExtensionService* service = browser()->profile()->GetExtensionService(); |
230 const Extension* extension = | 230 const extensions::Extension* extension = |
231 service->GetExtensionById(last_loaded_extension_id_, false); | 231 service->GetExtensionById(last_loaded_extension_id_, false); |
232 GURL url = extension->GetResourceURL("requestOpenTab/a.html"); | 232 GURL url = extension->GetResourceURL("requestOpenTab/a.html"); |
233 | 233 |
234 ui_test_utils::NavigateToURL(browser(), url); | 234 ui_test_utils::NavigateToURL(browser(), url); |
235 | 235 |
236 // There's a link on a.html. Middle-click on it to open it in a new tab. | 236 // There's a link on a.html. Middle-click on it to open it in a new tab. |
237 WebKit::WebMouseEvent mouse_event; | 237 WebKit::WebMouseEvent mouse_event; |
238 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 238 mouse_event.type = WebKit::WebInputEvent::MouseDown; |
239 mouse_event.button = WebKit::WebMouseEvent::ButtonMiddle; | 239 mouse_event.button = WebKit::WebMouseEvent::ButtonMiddle; |
240 mouse_event.x = 7; | 240 mouse_event.x = 7; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |