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

Side by Side Diff: chrome/browser/extensions/platform_app_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) 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/stringprintf.h" 6 #include "base/stringprintf.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/extensions/extension_browsertest.h" 9 #include "chrome/browser/extensions/extension_browsertest.h"
10 #include "chrome/browser/extensions/extension_host.h" 10 #include "chrome/browser/extensions/extension_host.h"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/extension_test_message_listener.h" 12 #include "chrome/browser/extensions/extension_test_message_listener.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/browser_list.h" 16 #include "chrome/browser/ui/browser_list.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/extensions/extension_constants.h" 18 #include "chrome/common/extensions/extension_constants.h"
19 #include "chrome/test/base/ui_test_utils.h" 19 #include "chrome/test/base/ui_test_utils.h"
20 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
21 #include "content/public/common/context_menu_params.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 #include "ui/base/models/menu_model.h" 23 #include "ui/base/models/menu_model.h"
23 #include "webkit/glue/context_menu.h"
24 24
25 using content::WebContents; 25 using content::WebContents;
26 26
27 namespace { 27 namespace {
28 // Non-abstract RenderViewContextMenu class. 28 // Non-abstract RenderViewContextMenu class.
29 class PlatformAppContextMenu : public RenderViewContextMenu { 29 class PlatformAppContextMenu : public RenderViewContextMenu {
30 public: 30 public:
31 PlatformAppContextMenu(WebContents* web_contents, 31 PlatformAppContextMenu(WebContents* web_contents,
32 const ContextMenuParams& params) 32 const content::ContextMenuParams& params)
33 : RenderViewContextMenu(web_contents, params) {} 33 : RenderViewContextMenu(web_contents, params) {}
34 34
35 protected: 35 protected:
36 // These two functions implement pure virtual methods of 36 // These two functions implement pure virtual methods of
37 // RenderViewContextMenu. 37 // RenderViewContextMenu.
38 virtual bool GetAcceleratorForCommandId(int command_id, 38 virtual bool GetAcceleratorForCommandId(int command_id,
39 ui::Accelerator* accelerator) { 39 ui::Accelerator* accelerator) {
40 return false; 40 return false;
41 } 41 }
42 virtual void PlatformInit() {} 42 virtual void PlatformInit() {}
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 124 }
125 125
126 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, EmptyContextMenu) { 126 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, EmptyContextMenu) {
127 LoadAndLaunchPlatformApp("empty"); 127 LoadAndLaunchPlatformApp("empty");
128 128
129 // The empty app doesn't add any context menu items, so its menu should 129 // The empty app doesn't add any context menu items, so its menu should
130 // only include the developer tools. 130 // only include the developer tools.
131 WebContents* web_contents = GetFirstPlatformAppWebContents(); 131 WebContents* web_contents = GetFirstPlatformAppWebContents();
132 ASSERT_TRUE(web_contents); 132 ASSERT_TRUE(web_contents);
133 WebKit::WebContextMenuData data; 133 WebKit::WebContextMenuData data;
134 ContextMenuParams params(data); 134 content::ContextMenuParams params(data);
135 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents, 135 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents,
136 params); 136 params);
137 menu->Init(); 137 menu->Init();
138 ASSERT_EQ(1, menu->menu_model().GetItemCount()); 138 ASSERT_EQ(1, menu->menu_model().GetItemCount());
139 } 139 }
140 140
141 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenu) { 141 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenu) {
142 ExtensionTestMessageListener listener1("created item", false); 142 ExtensionTestMessageListener listener1("created item", false);
143 LoadAndLaunchPlatformApp("context_menu"); 143 LoadAndLaunchPlatformApp("context_menu");
144 144
145 // Wait for the extension to tell us it's created an item. 145 // Wait for the extension to tell us it's created an item.
146 ASSERT_TRUE(listener1.WaitUntilSatisfied()); 146 ASSERT_TRUE(listener1.WaitUntilSatisfied());
147 147
148 // The context_menu app has one context menu item. This, along with a 148 // The context_menu app has one context menu item. This, along with a
149 // separator and the developer tools, is all that should be in the menu. 149 // separator and the developer tools, is all that should be in the menu.
150 WebContents* web_contents = GetFirstPlatformAppWebContents(); 150 WebContents* web_contents = GetFirstPlatformAppWebContents();
151 ASSERT_TRUE(web_contents); 151 ASSERT_TRUE(web_contents);
152 WebKit::WebContextMenuData data; 152 WebKit::WebContextMenuData data;
153 ContextMenuParams params(data); 153 content::ContextMenuParams params(data);
154 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents, 154 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents,
155 params); 155 params);
156 menu->Init(); 156 menu->Init();
157 ASSERT_EQ(3, menu->menu_model().GetItemCount()); 157 ASSERT_EQ(3, menu->menu_model().GetItemCount());
158 } 158 }
159 159
160 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisallowNavigation) { 160 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisallowNavigation) {
161 ASSERT_TRUE(test_server()->Start()); 161 ASSERT_TRUE(test_server()->Start());
162 162
163 LoadAndLaunchPlatformApp("navigation"); 163 LoadAndLaunchPlatformApp("navigation");
(...skipping 12 matching lines...) Expand all
176 } 176 }
177 177
178 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisallowModalDialogs) { 178 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisallowModalDialogs) {
179 ASSERT_TRUE(RunPlatformAppTest("platform_apps/modal_dialogs")) << message_; 179 ASSERT_TRUE(RunPlatformAppTest("platform_apps/modal_dialogs")) << message_;
180 } 180 }
181 181
182 // Tests that localStorage and WebSQL are disabled for platform apps. 182 // Tests that localStorage and WebSQL are disabled for platform apps.
183 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisallowStorage) { 183 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisallowStorage) {
184 ASSERT_TRUE(RunPlatformAppTest("platform_apps/storage")) << message_; 184 ASSERT_TRUE(RunPlatformAppTest("platform_apps/storage")) << message_;
185 } 185 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698