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/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 #endif | 311 #endif |
312 #if defined(USE_ASH) | 312 #if defined(USE_ASH) |
313 #if !defined(OS_WIN) | 313 #if !defined(OS_WIN) |
314 // On linux ash we close all popup applications when closing its extension. | 314 // On linux ash we close all popup applications when closing its extension. |
315 num_popups = 0; | 315 num_popups = 0; |
316 #endif | 316 #endif |
317 #endif | 317 #endif |
318 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 1, num_popups, 0)); | 318 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 1, num_popups, 0)); |
319 } | 319 } |
320 | 320 |
321 #if defined(OS_CHROMEOS) | 321 // This test isn't applicable on Chrome OS, which automatically reloads |
322 // TODO(derat): See if there's some way to get this to work on Chrome OS. It | 322 // crashed pages. |
323 // crashes there, apparently because we automatically reload crashed pages: | 323 #if !defined(OS_CHROMEOS) |
324 // http:/crbug.com/161073 | 324 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, ClosePanelsOnExtensionCrash) { |
325 #define MAYBE_ClosePanelsOnExtensionCrash DISABLED_ClosePanelsOnExtensionCrash | |
326 #else | |
327 #define MAYBE_ClosePanelsOnExtensionCrash ClosePanelsOnExtensionCrash | |
328 #endif | |
329 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_ClosePanelsOnExtensionCrash) { | |
330 #if defined(USE_ASH_PANELS) | 325 #if defined(USE_ASH_PANELS) |
331 // On Ash, new panel windows open as popup windows instead. | 326 // On Ash, new panel windows open as popup windows instead. |
332 int num_popups = 4; | 327 int num_popups = 4; |
333 int num_panels = 0; | 328 int num_panels = 0; |
334 #else | 329 #else |
335 int num_popups = 2; | 330 int num_popups = 2; |
336 int num_panels = 2; | 331 int num_panels = 2; |
337 #endif | 332 #endif |
338 ASSERT_TRUE(StartEmbeddedTestServer()); | 333 ASSERT_TRUE(StartEmbeddedTestServer()); |
339 | 334 |
(...skipping 29 matching lines...) Expand all Loading... |
369 extensions::ExtensionSystem::Get(browser()->profile())-> | 364 extensions::ExtensionSystem::Get(browser()->profile())-> |
370 process_manager()->GetBackgroundHostForExtension(extension->id()); | 365 process_manager()->GetBackgroundHostForExtension(extension->id()); |
371 ASSERT_TRUE(extension_host); | 366 ASSERT_TRUE(extension_host); |
372 base::KillProcess(extension_host->render_process_host()->GetHandle(), | 367 base::KillProcess(extension_host->render_process_host()->GetHandle(), |
373 content::RESULT_CODE_KILLED, false); | 368 content::RESULT_CODE_KILLED, false); |
374 WaitForExtensionCrash(extension->id()); | 369 WaitForExtensionCrash(extension->id()); |
375 | 370 |
376 // Only expect panels to close. The rest stay open to show a sad-tab. | 371 // Only expect panels to close. The rest stay open to show a sad-tab. |
377 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 2, num_popups, 0)); | 372 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 2, num_popups, 0)); |
378 } | 373 } |
| 374 #endif // !defined(OS_CHROMEOS) |
379 | 375 |
380 #if defined(USE_ASH_PANELS) | 376 #if defined(USE_ASH_PANELS) |
381 // This test is not applicable on Ash. The modified window.open behavior only | 377 // This test is not applicable on Ash. The modified window.open behavior only |
382 // applies to non-Ash panel windows. | 378 // applies to non-Ash panel windows. |
383 #define MAYBE_WindowOpenFromPanel DISABLED_WindowOpenFromPanel | 379 #define MAYBE_WindowOpenFromPanel DISABLED_WindowOpenFromPanel |
384 #else | 380 #else |
385 #define MAYBE_WindowOpenFromPanel WindowOpenFromPanel | 381 #define MAYBE_WindowOpenFromPanel WindowOpenFromPanel |
386 #endif | 382 #endif |
387 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_WindowOpenFromPanel) { | 383 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_WindowOpenFromPanel) { |
388 ASSERT_TRUE(StartEmbeddedTestServer()); | 384 ASSERT_TRUE(StartEmbeddedTestServer()); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(), | 461 OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(), |
466 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + | 462 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + |
467 "/newtab.html"), false, &newtab)); | 463 "/newtab.html"), false, &newtab)); |
468 | 464 |
469 // Extension API should succeed. | 465 // Extension API should succeed. |
470 bool result = false; | 466 bool result = false; |
471 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", | 467 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", |
472 &result)); | 468 &result)); |
473 EXPECT_TRUE(result); | 469 EXPECT_TRUE(result); |
474 } | 470 } |
OLD | NEW |