| 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 <list> | 5 #include <list> |
| 6 #include <set> | 6 #include <set> |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 using content::WebContents; | 47 using content::WebContents; |
| 48 | 48 |
| 49 namespace extensions { | 49 namespace extensions { |
| 50 | 50 |
| 51 namespace { | 51 namespace { |
| 52 | 52 |
| 53 // An UI-less RenderViewContextMenu. | 53 // An UI-less RenderViewContextMenu. |
| 54 class TestRenderViewContextMenu : public RenderViewContextMenu { | 54 class TestRenderViewContextMenu : public RenderViewContextMenu { |
| 55 public: | 55 public: |
| 56 TestRenderViewContextMenu(WebContents* web_contents, | 56 TestRenderViewContextMenu(content::RenderFrameHost* render_frame_host, |
| 57 const content::ContextMenuParams& params) | 57 const content::ContextMenuParams& params) |
| 58 : RenderViewContextMenu(web_contents, params) { | 58 : RenderViewContextMenu(render_frame_host, params) { |
| 59 } | 59 } |
| 60 virtual ~TestRenderViewContextMenu() {} | 60 virtual ~TestRenderViewContextMenu() {} |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 virtual void PlatformInit() OVERRIDE {} | 63 virtual void PlatformInit() OVERRIDE {} |
| 64 virtual void PlatformCancel() OVERRIDE {} | 64 virtual void PlatformCancel() OVERRIDE {} |
| 65 virtual bool GetAcceleratorForCommandId(int, ui::Accelerator*) OVERRIDE { | 65 virtual bool GetAcceleratorForCommandId(int, ui::Accelerator*) OVERRIDE { |
| 66 return false; | 66 return false; |
| 67 } | 67 } |
| 68 | 68 |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 | 513 |
| 514 // This corresponds to "Open link in new tab". | 514 // This corresponds to "Open link in new tab". |
| 515 content::ContextMenuParams params; | 515 content::ContextMenuParams params; |
| 516 params.is_editable = false; | 516 params.is_editable = false; |
| 517 params.media_type = blink::WebContextMenuData::MediaTypeNone; | 517 params.media_type = blink::WebContextMenuData::MediaTypeNone; |
| 518 params.page_url = url; | 518 params.page_url = url; |
| 519 params.frame_id = WebNavigationTabObserver::Get(tab)-> | 519 params.frame_id = WebNavigationTabObserver::Get(tab)-> |
| 520 frame_navigation_state().GetMainFrameID().frame_num; | 520 frame_navigation_state().GetMainFrameID().frame_num; |
| 521 params.link_url = extension->GetResourceURL("b.html"); | 521 params.link_url = extension->GetResourceURL("b.html"); |
| 522 | 522 |
| 523 TestRenderViewContextMenu menu(tab, params); | 523 TestRenderViewContextMenu menu(tab->GetMainFrame(), params); |
| 524 menu.Init(); | 524 menu.Init(); |
| 525 menu.ExecuteCommand(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB, 0); | 525 menu.ExecuteCommand(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB, 0); |
| 526 | 526 |
| 527 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 527 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 528 } | 528 } |
| 529 | 529 |
| 530 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, RequestOpenTab) { | 530 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, RequestOpenTab) { |
| 531 ASSERT_TRUE(StartEmbeddedTestServer()); | 531 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 532 | 532 |
| 533 // Wait for the extension to set itself up and return control to us. | 533 // Wait for the extension to set itself up and return control to us. |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 url = GURL(base::StringPrintf( | 715 url = GURL(base::StringPrintf( |
| 716 "http://www.a.com:%d/" | 716 "http://www.a.com:%d/" |
| 717 "extensions/api_test/webnavigation/crash/b.html", | 717 "extensions/api_test/webnavigation/crash/b.html", |
| 718 embedded_test_server()->port())); | 718 embedded_test_server()->port())); |
| 719 ui_test_utils::NavigateToURL(browser(), url); | 719 ui_test_utils::NavigateToURL(browser(), url); |
| 720 | 720 |
| 721 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 721 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 722 } | 722 } |
| 723 | 723 |
| 724 } // namespace extensions | 724 } // namespace extensions |
| OLD | NEW |