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

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

Issue 9569042: Add reload item to default developer-mode platform app context menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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/tab_contents/render_view_context_menu.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/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"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 content::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(2, menu->menu_model().GetItemCount());
benwells 2012/03/02 00:13:18 These tests are a bit painful as they are written
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 content::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(4, 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");
164 WebContents* web_contents = GetFirstPlatformAppWebContents(); 164 WebContents* web_contents = GetFirstPlatformAppWebContents();
165 165
166 GURL remote_url = test_server()->GetURL( 166 GURL remote_url = test_server()->GetURL(
167 "files/extensions/platform_apps/navigation/nav-target.html"); 167 "files/extensions/platform_apps/navigation/nav-target.html");
168 168
169 std::string script = StringPrintf( 169 std::string script = StringPrintf(
170 "runTests(\"%s\")", remote_url.spec().c_str()); 170 "runTests(\"%s\")", remote_url.spec().c_str());
171 bool result = false; 171 bool result = false;
172 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 172 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
173 web_contents->GetRenderViewHost(), L"", 173 web_contents->GetRenderViewHost(), L"",
174 UTF8ToWide(script), &result)); 174 UTF8ToWide(script), &result));
175 EXPECT_TRUE(result); 175 EXPECT_TRUE(result);
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
« no previous file with comments | « no previous file | chrome/browser/tab_contents/render_view_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698