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

Side by Side Diff: chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc

Issue 9382037: Move ContextMenuParams struct from webkit/glue to content/public/common. The reasons are: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 8 years, 10 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/test/base/in_process_browser_test.h" 13 #include "chrome/test/base/in_process_browser_test.h"
14 #include "chrome/test/base/ui_test_utils.h" 14 #include "chrome/test/base/ui_test_utils.h"
15 #include "content/public/browser/navigation_controller.h" 15 #include "content/public/browser/navigation_controller.h"
16 #include "content/public/browser/navigation_entry.h" 16 #include "content/public/browser/navigation_entry.h"
17 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
19 19
20 using content::WebContents; 20 using content::WebContents;
21 21
22 namespace { 22 namespace {
23 23
24 class TestRenderViewContextMenu : public RenderViewContextMenu { 24 class TestRenderViewContextMenu : public RenderViewContextMenu {
25 public: 25 public:
26 TestRenderViewContextMenu(WebContents* web_contents, ContextMenuParams params) 26 TestRenderViewContextMenu(WebContents* web_contents,
27 content::ContextMenuParams params)
27 : RenderViewContextMenu(web_contents, params) { } 28 : RenderViewContextMenu(web_contents, params) { }
28 29
29 virtual void PlatformInit() { } 30 virtual void PlatformInit() { }
30 virtual bool GetAcceleratorForCommandId( 31 virtual bool GetAcceleratorForCommandId(
31 int command_id, 32 int command_id,
32 ui::Accelerator* accelerator) { 33 ui::Accelerator* accelerator) {
33 return false; 34 return false;
34 } 35 }
35 36
36 bool IsItemPresent(int command_id) { 37 bool IsItemPresent(int command_id) {
37 return menu_model_.GetIndexOfCommandId(command_id) != -1; 38 return menu_model_.GetIndexOfCommandId(command_id) != -1;
38 } 39 }
39 }; 40 };
40 41
41 class RegisterProtocolHandlerBrowserTest : public InProcessBrowserTest { 42 class RegisterProtocolHandlerBrowserTest : public InProcessBrowserTest {
42 public: 43 public:
43 RegisterProtocolHandlerBrowserTest() { } 44 RegisterProtocolHandlerBrowserTest() { }
44 45
45 TestRenderViewContextMenu* CreateContextMenu(GURL url) { 46 TestRenderViewContextMenu* CreateContextMenu(GURL url) {
46 ContextMenuParams params; 47 content::ContextMenuParams params;
47 params.media_type = WebKit::WebContextMenuData::MediaTypeNone; 48 params.media_type = WebKit::WebContextMenuData::MediaTypeNone;
48 params.link_url = url; 49 params.link_url = url;
49 params.unfiltered_link_url = url; 50 params.unfiltered_link_url = url;
50 WebContents* web_contents = browser()->GetSelectedWebContents(); 51 WebContents* web_contents = browser()->GetSelectedWebContents();
51 params.page_url = web_contents->GetController().GetActiveEntry()->GetURL(); 52 params.page_url = web_contents->GetController().GetActiveEntry()->GetURL();
52 #if defined(OS_MACOSX) 53 #if defined(OS_MACOSX)
53 params.writing_direction_default = 0; 54 params.writing_direction_default = 0;
54 params.writing_direction_left_to_right = 0; 55 params.writing_direction_left_to_right = 0;
55 params.writing_direction_right_to_left = 0; 56 params.writing_direction_right_to_left = 0;
56 #endif // OS_MACOSX 57 #endif // OS_MACOSX
(...skipping 19 matching lines...) Expand all
76 77
77 GURL url("web+search:testing"); 78 GURL url("web+search:testing");
78 registry->OnAcceptRegisterProtocolHandler(handler); 79 registry->OnAcceptRegisterProtocolHandler(handler);
79 ASSERT_TRUE(registry->IsHandledProtocol("web+search")); 80 ASSERT_TRUE(registry->IsHandledProtocol("web+search"));
80 ASSERT_EQ(registry->GetHandlersFor(url.scheme()).size(), (size_t) 1); 81 ASSERT_EQ(registry->GetHandlersFor(url.scheme()).size(), (size_t) 1);
81 menu.reset(CreateContextMenu(url)); 82 menu.reset(CreateContextMenu(url));
82 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKWITH)); 83 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKWITH));
83 } 84 }
84 85
85 } // namespace 86 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698