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

Side by Side Diff: chrome/browser/extensions/extension_context_menu_browsertest.cc

Issue 15049004: Move ContextMenuParams(WebContextMenuInfo) ctor to content/renderer/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: class -> struct Created 7 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/extensions/platform_app_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/app/chrome_command_ids.h" 6 #include "chrome/app/chrome_command_ids.h"
7 #include "chrome/browser/extensions/extension_browsertest.h" 7 #include "chrome/browser/extensions/extension_browsertest.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/extensions/extension_test_message_listener.h" 10 #include "chrome/browser/extensions/extension_test_message_listener.h"
11 #include "chrome/browser/extensions/lazy_background_page_test_util.h" 11 #include "chrome/browser/extensions/lazy_background_page_test_util.h"
12 #include "chrome/browser/extensions/test_management_policy.h" 12 #include "chrome/browser/extensions/test_management_policy.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/tab_contents/render_view_context_menu.h" 14 #include "chrome/browser/tab_contents/render_view_context_menu.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" 16 #include "chrome/browser/ui/tabs/tab_strip_model.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/test/base/ui_test_utils.h" 18 #include "chrome/test/base/ui_test_utils.h"
19 #include "content/public/common/context_menu_params.h" 19 #include "content/public/common/context_menu_params.h"
20 #include "net/dns/mock_host_resolver.h" 20 #include "net/dns/mock_host_resolver.h"
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
22 #include "ui/base/models/menu_model.h" 21 #include "ui/base/models/menu_model.h"
23 22
24 using WebKit::WebContextMenuData;
25 using content::WebContents; 23 using content::WebContents;
26 using extensions::MenuItem; 24 using extensions::MenuItem;
27 using ui::MenuModel; 25 using ui::MenuModel;
28 26
29 namespace { 27 namespace {
30 // This test class helps us sidestep platform-specific issues with popping up a 28 // This test class helps us sidestep platform-specific issues with popping up a
31 // real context menu, while still running through the actual code in 29 // real context menu, while still running through the actual code in
32 // RenderViewContextMenu where extension items get added and executed. 30 // RenderViewContextMenu where extension items get added and executed.
33 class TestRenderViewContextMenu : public RenderViewContextMenu { 31 class TestRenderViewContextMenu : public RenderViewContextMenu {
34 public: 32 public:
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 test_data_dir_.AppendASCII("context_menus").AppendASCII(subdirectory); 98 test_data_dir_.AppendASCII("context_menus").AppendASCII(subdirectory);
101 return LoadExtensionIncognito(extension_dir); 99 return LoadExtensionIncognito(extension_dir);
102 } 100 }
103 101
104 TestRenderViewContextMenu* CreateMenu(Browser* browser, 102 TestRenderViewContextMenu* CreateMenu(Browser* browser,
105 const GURL& page_url, 103 const GURL& page_url,
106 const GURL& link_url, 104 const GURL& link_url,
107 const GURL& frame_url) { 105 const GURL& frame_url) {
108 WebContents* web_contents = 106 WebContents* web_contents =
109 browser->tab_strip_model()->GetActiveWebContents(); 107 browser->tab_strip_model()->GetActiveWebContents();
110 WebContextMenuData data; 108 content::ContextMenuParams params;
111 content::ContextMenuParams params(data);
112 params.page_url = page_url; 109 params.page_url = page_url;
113 params.link_url = link_url; 110 params.link_url = link_url;
114 params.frame_url = frame_url; 111 params.frame_url = frame_url;
115 TestRenderViewContextMenu* menu = 112 TestRenderViewContextMenu* menu =
116 new TestRenderViewContextMenu(web_contents, params); 113 new TestRenderViewContextMenu(web_contents, params);
117 menu->Init(); 114 menu->Init();
118 return menu; 115 return menu;
119 } 116 }
120 117
121 // Shortcut to return the current MenuManager. 118 // Shortcut to return the current MenuManager.
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 ASSERT_TRUE(LoadContextMenuExtensionIncognito("incognito")); 583 ASSERT_TRUE(LoadContextMenuExtensionIncognito("incognito"));
587 584
588 // Wait for the extension's processes to tell us they've created an item. 585 // Wait for the extension's processes to tell us they've created an item.
589 ASSERT_TRUE(created.WaitUntilSatisfied()); 586 ASSERT_TRUE(created.WaitUntilSatisfied());
590 ASSERT_TRUE(created_incognito.WaitUntilSatisfied()); 587 ASSERT_TRUE(created_incognito.WaitUntilSatisfied());
591 ASSERT_EQ(2u, GetItems().size()); 588 ASSERT_EQ(2u, GetItems().size());
592 589
593 browser()->profile()->DestroyOffTheRecordProfile(); 590 browser()->profile()->DestroyOffTheRecordProfile();
594 ASSERT_EQ(1u, GetItems().size()); 591 ASSERT_EQ(1u, GetItems().size());
595 } 592 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/platform_app_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698