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 "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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // Disabled until shell windows are implemented for non-GTK, non-Views toolkits. | 134 // Disabled until shell windows are implemented for non-GTK, non-Views toolkits. |
135 #if defined(TOOLKIT_GTK) || defined(TOOLKIT_VIEWS) | 135 #if defined(TOOLKIT_GTK) || defined(TOOLKIT_VIEWS) |
136 #define MAYBE_EmptyContextMenu EmptyContextMenu | 136 #define MAYBE_EmptyContextMenu EmptyContextMenu |
137 #else | 137 #else |
138 #define MAYBE_EmptyContextMenu DISABLED_EmptyContextMenu | 138 #define MAYBE_EmptyContextMenu DISABLED_EmptyContextMenu |
139 #endif | 139 #endif |
140 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_EmptyContextMenu) { | 140 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_EmptyContextMenu) { |
141 LoadAndLaunchPlatformApp("empty"); | 141 LoadAndLaunchPlatformApp("empty"); |
142 | 142 |
143 // The empty app doesn't add any context menu items, so its menu should | 143 // The empty app doesn't add any context menu items, so its menu should |
144 // be empty. | 144 // only include the developer tools. |
145 WebContents* web_contents = GetFirstPlatformAppWebContents(); | 145 WebContents* web_contents = GetFirstPlatformAppWebContents(); |
146 ASSERT_TRUE(web_contents); | 146 ASSERT_TRUE(web_contents); |
147 WebKit::WebContextMenuData data; | 147 WebKit::WebContextMenuData data; |
148 ContextMenuParams params(data); | 148 ContextMenuParams params(data); |
149 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents, | 149 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents, |
150 params); | 150 params); |
151 menu->Init(); | 151 menu->Init(); |
152 ASSERT_FALSE(menu->menu_model().GetItemCount()); | 152 ASSERT_EQ(1, menu->menu_model().GetItemCount()); |
153 } | 153 } |
154 | 154 |
155 // Disabled until shell windows are implemented for non-GTK, non-Views toolkits. | 155 // Disabled until shell windows are implemented for non-GTK, non-Views toolkits. |
156 #if defined(TOOLKIT_GTK) || defined(TOOLKIT_VIEWS) | 156 #if defined(TOOLKIT_GTK) || defined(TOOLKIT_VIEWS) |
157 #define MAYBE_AppWithContextMenu AppWithContextMenu | 157 #define MAYBE_AppWithContextMenu AppWithContextMenu |
158 #else | 158 #else |
159 #define MAYBE_AppWithContextMenu DISABLED_AppWithContextMenu | 159 #define MAYBE_AppWithContextMenu DISABLED_AppWithContextMenu |
160 #endif | 160 #endif |
161 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_AppWithContextMenu) { | 161 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_AppWithContextMenu) { |
162 ExtensionTestMessageListener listener1("created item", false); | 162 ExtensionTestMessageListener listener1("created item", false); |
163 LoadAndLaunchPlatformApp("context_menu"); | 163 LoadAndLaunchPlatformApp("context_menu"); |
164 | 164 |
165 // Wait for the extension to tell us it's created an item. | 165 // Wait for the extension to tell us it's created an item. |
166 ASSERT_TRUE(listener1.WaitUntilSatisfied()); | 166 ASSERT_TRUE(listener1.WaitUntilSatisfied()); |
167 | 167 |
168 // The context_menu app has one context menu item. This is all that should | 168 // The context_menu app has one context menu item. This, along with a |
169 // be in the menu, there should be no seperator. | 169 // separator and the developer tools, is all that should be in the menu. |
170 WebContents* web_contents = GetFirstPlatformAppWebContents(); | 170 WebContents* web_contents = GetFirstPlatformAppWebContents(); |
171 ASSERT_TRUE(web_contents); | 171 ASSERT_TRUE(web_contents); |
172 WebKit::WebContextMenuData data; | 172 WebKit::WebContextMenuData data; |
173 ContextMenuParams params(data); | 173 ContextMenuParams params(data); |
174 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents, | 174 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents, |
175 params); | 175 params); |
176 menu->Init(); | 176 menu->Init(); |
177 ASSERT_EQ(1, menu->menu_model().GetItemCount()); | 177 ASSERT_EQ(3, menu->menu_model().GetItemCount()); |
178 } | 178 } |
179 | 179 |
180 // Disabled until shell windows are implemented for non-GTK, non-Views toolkits. | 180 // Disabled until shell windows are implemented for non-GTK, non-Views toolkits. |
181 #if defined(TOOLKIT_GTK) || defined(TOOLKIT_VIEWS) | 181 #if defined(TOOLKIT_GTK) || defined(TOOLKIT_VIEWS) |
182 #define MAYBE_DisallowNavigation DisallowNavigation | 182 #define MAYBE_DisallowNavigation DisallowNavigation |
183 #else | 183 #else |
184 #define MAYBE_DisallowNavigation DISABLED_DisallowNavigation | 184 #define MAYBE_DisallowNavigation DISABLED_DisallowNavigation |
185 #endif | 185 #endif |
186 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_DisallowNavigation) { | 186 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_DisallowNavigation) { |
187 ASSERT_TRUE(test_server()->Start()); | 187 ASSERT_TRUE(test_server()->Start()); |
(...skipping 26 matching lines...) Expand all Loading... |
214 // Tests that localStorage and WebSQL are disabled for platform apps. | 214 // Tests that localStorage and WebSQL are disabled for platform apps. |
215 // Disabled until shell windows are implemented for non-GTK, non-Views toolkits. | 215 // Disabled until shell windows are implemented for non-GTK, non-Views toolkits. |
216 #if defined(TOOLKIT_GTK) || defined(TOOLKIT_VIEWS) | 216 #if defined(TOOLKIT_GTK) || defined(TOOLKIT_VIEWS) |
217 #define MAYBE_DisallowStorage DisallowStorage | 217 #define MAYBE_DisallowStorage DisallowStorage |
218 #else | 218 #else |
219 #define MAYBE_DisallowStorage DISABLED_DisallowStorage | 219 #define MAYBE_DisallowStorage DISABLED_DisallowStorage |
220 #endif | 220 #endif |
221 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_DisallowStorage) { | 221 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_DisallowStorage) { |
222 ASSERT_TRUE(RunPlatformAppTest("platform_apps/storage")) << message_; | 222 ASSERT_TRUE(RunPlatformAppTest("platform_apps/storage")) << message_; |
223 } | 223 } |
OLD | NEW |