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/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "extensions/common/extension.h" | 28 #include "extensions/common/extension.h" |
29 #include "extensions/common/switches.h" | 29 #include "extensions/common/switches.h" |
30 #include "net/dns/mock_host_resolver.h" | 30 #include "net/dns/mock_host_resolver.h" |
31 #include "net/test/embedded_test_server/embedded_test_server.h" | 31 #include "net/test/embedded_test_server/embedded_test_server.h" |
32 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
33 | 33 |
34 #if defined(USE_ASH) | 34 #if defined(USE_ASH) |
35 #include "apps/app_window_registry.h" | 35 #include "apps/app_window_registry.h" |
36 #endif | 36 #endif |
37 | 37 |
38 #if defined(USE_ASH) && defined(OS_CHROMEOS) | 38 #if defined(USE_ASH) && !defined(OS_WIN) |
39 // TODO(stevenjb): Figure out the correct behavior for Ash + Win | 39 // TODO(stevenjb): Figure out the correct behavior for Ash + Win |
40 #define USE_ASH_PANELS | 40 #define USE_ASH_PANELS |
41 #endif | 41 #endif |
42 | 42 |
43 using content::OpenURLParams; | 43 using content::OpenURLParams; |
44 using content::Referrer; | 44 using content::Referrer; |
45 using content::WebContents; | 45 using content::WebContents; |
46 | 46 |
47 // Disabled, http://crbug.com/64899. | 47 // Disabled, http://crbug.com/64899. |
48 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_WindowOpen) { | 48 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_WindowOpen) { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // We're also failing on Linux-aura due to the panel is not opened in the | 266 // We're also failing on Linux-aura due to the panel is not opened in the |
267 // right origin. | 267 // right origin. |
268 #define MAYBE_WindowOpenPanelDetached DISABLED_WindowOpenPanelDetached | 268 #define MAYBE_WindowOpenPanelDetached DISABLED_WindowOpenPanelDetached |
269 #else | 269 #else |
270 #define MAYBE_WindowOpenPanelDetached WindowOpenPanelDetached | 270 #define MAYBE_WindowOpenPanelDetached WindowOpenPanelDetached |
271 #endif | 271 #endif |
272 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_WindowOpenPanelDetached) { | 272 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_WindowOpenPanelDetached) { |
273 ASSERT_TRUE(RunExtensionTest("window_open/panel_detached")) << message_; | 273 ASSERT_TRUE(RunExtensionTest("window_open/panel_detached")) << message_; |
274 } | 274 } |
275 | 275 |
276 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | |
277 // TODO(erg): Bring up ash http://crbug.com/300084 | |
278 #define MAYBE_CloseNonExtensionPanelsOnUninstall \ | |
279 DISABLED_CloseNonExtensionPanelsOnUninstall | |
280 #else | |
281 #define MAYBE_CloseNonExtensionPanelsOnUninstall \ | |
282 CloseNonExtensionPanelsOnUninstall | |
283 #endif | |
284 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, | 276 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, |
285 MAYBE_CloseNonExtensionPanelsOnUninstall) { | 277 CloseNonExtensionPanelsOnUninstall) { |
286 #if defined(OS_WIN) && defined(USE_ASH) | 278 #if defined(OS_WIN) && defined(USE_ASH) |
287 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 279 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
288 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 280 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
289 return; | 281 return; |
290 #endif | 282 #endif |
291 | 283 |
292 #if defined(USE_ASH_PANELS) | 284 #if defined(USE_ASH_PANELS) |
293 // On Ash, new panel windows open as popup windows instead. | 285 // On Ash, new panel windows open as popup windows instead. |
294 int num_popups, num_panels; | 286 int num_popups, num_panels; |
295 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePanels)) { | 287 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePanels)) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 #endif | 338 #endif |
347 #if defined(USE_ASH) | 339 #if defined(USE_ASH) |
348 #if !defined(OS_WIN) | 340 #if !defined(OS_WIN) |
349 // On linux ash we close all popup applications when closing its extension. | 341 // On linux ash we close all popup applications when closing its extension. |
350 num_popups = 0; | 342 num_popups = 0; |
351 #endif | 343 #endif |
352 #endif | 344 #endif |
353 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 1, num_popups, 0)); | 345 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 1, num_popups, 0)); |
354 } | 346 } |
355 | 347 |
356 // This test isn't applicable on Chrome OS, which automatically reloads crashed | 348 // This test isn't applicable on Chrome OS, which automatically reloads |
357 // pages. | 349 // crashed pages. |
358 #if !defined(OS_CHROMEOS) | 350 #if !defined(OS_CHROMEOS) |
359 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, ClosePanelsOnExtensionCrash) { | 351 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, ClosePanelsOnExtensionCrash) { |
360 #if defined(USE_ASH_PANELS) | 352 #if defined(USE_ASH_PANELS) |
361 // On Ash, new panel windows open as popup windows instead. | 353 // On Ash, new panel windows open as popup windows instead. |
362 int num_popups = 4; | 354 int num_popups = 4; |
363 int num_panels = 0; | 355 int num_panels = 0; |
364 #else | 356 #else |
365 int num_popups = 2; | 357 int num_popups = 2; |
366 int num_panels = 2; | 358 int num_panels = 2; |
367 #endif | 359 #endif |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(), | 488 OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(), |
497 GURL(std::string("chrome-extension://") + last_loaded_extension_id() + | 489 GURL(std::string("chrome-extension://") + last_loaded_extension_id() + |
498 "/newtab.html"), false, &newtab)); | 490 "/newtab.html"), false, &newtab)); |
499 | 491 |
500 // Extension API should succeed. | 492 // Extension API should succeed. |
501 bool result = false; | 493 bool result = false; |
502 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", | 494 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", |
503 &result)); | 495 &result)); |
504 EXPECT_TRUE(result); | 496 EXPECT_TRUE(result); |
505 } | 497 } |
OLD | NEW |