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

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

Issue 10908153: [Panel refactor] Deprecate old panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix views compile, no need to delete extra mac menu items cuz not using browser command updater any… Created 8 years, 3 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/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/extensions/extension_test_message_listener.h" 9 #include "chrome/browser/extensions/extension_test_message_listener.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 }; 201 };
202 202
203 #if defined(USE_ASH) 203 #if defined(USE_ASH)
204 // On Ash, this currently fails because we're currently opening new panel 204 // On Ash, this currently fails because we're currently opening new panel
205 // windows as popup windows instead. 205 // windows as popup windows instead.
206 #define MAYBE_WindowOpenPanel FAILS_WindowOpenPanel 206 #define MAYBE_WindowOpenPanel FAILS_WindowOpenPanel
207 #else 207 #else
208 #define MAYBE_WindowOpenPanel WindowOpenPanel 208 #define MAYBE_WindowOpenPanel WindowOpenPanel
209 #endif 209 #endif
210 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_WindowOpenPanel) { 210 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_WindowOpenPanel) {
211 if (!PanelManager::UseBrowserlessPanels())
212 return;
213 ASSERT_TRUE(RunExtensionTest("window_open/panel")) << message_; 211 ASSERT_TRUE(RunExtensionTest("window_open/panel")) << message_;
214 } 212 }
215 213
216 #if defined(USE_ASH) 214 #if defined(USE_ASH)
217 // On Ash, this currently fails because we're currently opening new panel 215 // On Ash, this currently fails because we're currently opening new panel
218 // windows as popup windows instead. 216 // windows as popup windows instead.
219 #define MAYBE_WindowOpenPanelDetached FAILS_WindowOpenPanelDetached 217 #define MAYBE_WindowOpenPanelDetached FAILS_WindowOpenPanelDetached
220 #else 218 #else
221 #define MAYBE_WindowOpenPanelDetached WindowOpenPanelDetached 219 #define MAYBE_WindowOpenPanelDetached WindowOpenPanelDetached
222 #endif 220 #endif
223 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_WindowOpenPanelDetached) { 221 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_WindowOpenPanelDetached) {
224 if (!PanelManager::UseBrowserlessPanels())
225 return;
226 ASSERT_TRUE(RunExtensionTest("window_open/panel_detached")) << message_; 222 ASSERT_TRUE(RunExtensionTest("window_open/panel_detached")) << message_;
227 } 223 }
228 224
229 #if defined(OS_MACOSX) || defined(OS_WIN) 225 #if defined(OS_MACOSX) || defined(OS_WIN)
230 // Focus test fails if there is no window manager on Linux. 226 // Focus test fails if there is no window manager on Linux.
231 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, WindowOpenFocus) { 227 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, WindowOpenFocus) {
232 if (!PanelManager::UseBrowserlessPanels())
233 return;
234 ASSERT_TRUE(RunExtensionTest("window_open/focus")) << message_; 228 ASSERT_TRUE(RunExtensionTest("window_open/focus")) << message_;
235 } 229 }
236 #endif 230 #endif
237 231
238 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, 232 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest,
239 CloseNonExtensionPanelsOnUninstall) { 233 CloseNonExtensionPanelsOnUninstall) {
240 if (!PanelManager::UseBrowserlessPanels())
241 return;
242 #if defined(USE_ASH) 234 #if defined(USE_ASH)
243 // On Ash, new panel windows open as popup windows instead. 235 // On Ash, new panel windows open as popup windows instead.
244 int num_popups = 4; 236 int num_popups = 4;
245 int num_panels = 0; 237 int num_panels = 0;
246 #else 238 #else
247 int num_popups = 2; 239 int num_popups = 2;
248 int num_panels = 2; 240 int num_panels = 2;
249 #endif 241 #endif
250 ASSERT_TRUE(StartTestServer()); 242 ASSERT_TRUE(StartTestServer());
251 243
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 277 }
286 278
287 #if defined(USE_ASH) 279 #if defined(USE_ASH)
288 // This test is not applicable on Ash. Ash opens panel windows as popup 280 // This test is not applicable on Ash. Ash opens panel windows as popup
289 // windows. The modified window.open behavior only applies to panel windows. 281 // windows. The modified window.open behavior only applies to panel windows.
290 #define MAYBE_WindowOpenFromPanel DISABLED_WindowOpenFromPanel 282 #define MAYBE_WindowOpenFromPanel DISABLED_WindowOpenFromPanel
291 #else 283 #else
292 #define MAYBE_WindowOpenFromPanel WindowOpenFromPanel 284 #define MAYBE_WindowOpenFromPanel WindowOpenFromPanel
293 #endif 285 #endif
294 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_WindowOpenFromPanel) { 286 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_WindowOpenFromPanel) {
295 if (!PanelManager::UseBrowserlessPanels())
296 return;
297
298 ASSERT_TRUE(StartTestServer()); 287 ASSERT_TRUE(StartTestServer());
299 288
300 // Load the extension that will open a panel which then calls window.open. 289 // Load the extension that will open a panel which then calls window.open.
301 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("window_open"). 290 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("window_open").
302 AppendASCII("panel_window_open"))); 291 AppendASCII("panel_window_open")));
303 292
304 // Expect one panel (opened by extension) and one tab (from the panel calling 293 // Expect one panel (opened by extension) and one tab (from the panel calling
305 // window.open). Panels modify the WindowOpenDisposition in window.open 294 // window.open). Panels modify the WindowOpenDisposition in window.open
306 // to always open in a tab. 295 // to always open in a tab.
307 WaitForTabsAndPopups(browser(), 1, 0, 1); 296 WaitForTabsAndPopups(browser(), 1, 0, 1);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 ASSERT_NO_FATAL_FAILURE(OpenWindow(chrome::GetActiveWebContents(browser()), 348 ASSERT_NO_FATAL_FAILURE(OpenWindow(chrome::GetActiveWebContents(browser()),
360 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + 349 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ +
361 "/newtab.html"), false, &newtab)); 350 "/newtab.html"), false, &newtab));
362 351
363 // Extension API should succeed. 352 // Extension API should succeed.
364 bool result = false; 353 bool result = false;
365 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( 354 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool(
366 newtab->GetRenderViewHost(), L"", L"testExtensionApi()", &result)); 355 newtab->GetRenderViewHost(), L"", L"testExtensionApi()", &result));
367 EXPECT_TRUE(result); 356 EXPECT_TRUE(result);
368 } 357 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698