| 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_WIN) | 38 #if defined(USE_ASH) && defined(OS_CHROMEOS) | 
| 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 | 
| 276 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, | 284 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, | 
| 277                        CloseNonExtensionPanelsOnUninstall) { | 285                        MAYBE_CloseNonExtensionPanelsOnUninstall) { | 
| 278 #if defined(OS_WIN) && defined(USE_ASH) | 286 #if defined(OS_WIN) && defined(USE_ASH) | 
| 279   // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 287   // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 
| 280   if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 288   if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 
| 281     return; | 289     return; | 
| 282 #endif | 290 #endif | 
| 283 | 291 | 
| 284 #if defined(USE_ASH_PANELS) | 292 #if defined(USE_ASH_PANELS) | 
| 285   // On Ash, new panel windows open as popup windows instead. | 293   // On Ash, new panel windows open as popup windows instead. | 
| 286   int num_popups, num_panels; | 294   int num_popups, num_panels; | 
| 287   if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePanels)) { | 295   if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePanels)) { | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 338 #endif | 346 #endif | 
| 339 #if defined(USE_ASH) | 347 #if defined(USE_ASH) | 
| 340 #if !defined(OS_WIN) | 348 #if !defined(OS_WIN) | 
| 341   // On linux ash we close all popup applications when closing its extension. | 349   // On linux ash we close all popup applications when closing its extension. | 
| 342   num_popups = 0; | 350   num_popups = 0; | 
| 343 #endif | 351 #endif | 
| 344 #endif | 352 #endif | 
| 345   EXPECT_TRUE(WaitForTabsAndPopups(browser(), 1, num_popups, 0)); | 353   EXPECT_TRUE(WaitForTabsAndPopups(browser(), 1, num_popups, 0)); | 
| 346 } | 354 } | 
| 347 | 355 | 
| 348 // This test isn't applicable on Chrome OS, which automatically reloads | 356 // This test isn't applicable on Chrome OS, which automatically reloads crashed | 
| 349 // crashed pages. | 357 // pages. | 
| 350 #if !defined(OS_CHROMEOS) | 358 #if !defined(OS_CHROMEOS) | 
| 351 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, ClosePanelsOnExtensionCrash) { | 359 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, ClosePanelsOnExtensionCrash) { | 
| 352 #if defined(USE_ASH_PANELS) | 360 #if defined(USE_ASH_PANELS) | 
| 353   // On Ash, new panel windows open as popup windows instead. | 361   // On Ash, new panel windows open as popup windows instead. | 
| 354   int num_popups = 4; | 362   int num_popups = 4; | 
| 355   int num_panels = 0; | 363   int num_panels = 0; | 
| 356 #else | 364 #else | 
| 357   int num_popups = 2; | 365   int num_popups = 2; | 
| 358   int num_panels = 2; | 366   int num_panels = 2; | 
| 359 #endif | 367 #endif | 
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 488       OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(), | 496       OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(), | 
| 489       GURL(std::string("chrome-extension://") + last_loaded_extension_id() + | 497       GURL(std::string("chrome-extension://") + last_loaded_extension_id() + | 
| 490           "/newtab.html"), false, &newtab)); | 498           "/newtab.html"), false, &newtab)); | 
| 491 | 499 | 
| 492   // Extension API should succeed. | 500   // Extension API should succeed. | 
| 493   bool result = false; | 501   bool result = false; | 
| 494   ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", | 502   ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", | 
| 495                                                    &result)); | 503                                                    &result)); | 
| 496   EXPECT_TRUE(result); | 504   EXPECT_TRUE(result); | 
| 497 } | 505 } | 
| OLD | NEW | 
|---|