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 "chrome/browser/browser_process.h" | 5 #include "chrome/browser/browser_process.h" |
6 #include "chrome/browser/extensions/extension_browsertest.h" | 6 #include "chrome/browser/extensions/extension_browsertest.h" |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/notifications/notification.h" | 8 #include "chrome/browser/notifications/notification.h" |
9 #include "chrome/browser/notifications/notification_delegate.h" | 9 #include "chrome/browser/notifications/notification_delegate.h" |
10 #include "chrome/browser/notifications/notification_ui_manager.h" | 10 #include "chrome/browser/notifications/notification_ui_manager.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_commands.h" | 13 #include "chrome/browser/ui/browser_commands.h" |
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
15 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
16 #include "content/public/browser/navigation_controller.h" | 16 #include "content/public/browser/navigation_controller.h" |
17 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
18 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
20 #include "content/public/common/result_codes.h" | 20 #include "content/public/common/result_codes.h" |
| 21 #include "content/public/common/url_constants.h" |
21 #include "extensions/browser/extension_host.h" | 22 #include "extensions/browser/extension_host.h" |
22 #include "extensions/browser/extension_registry.h" | 23 #include "extensions/browser/extension_registry.h" |
23 #include "extensions/browser/extension_system.h" | 24 #include "extensions/browser/extension_system.h" |
24 #include "extensions/browser/process_manager.h" | 25 #include "extensions/browser/process_manager.h" |
25 #include "extensions/browser/process_map.h" | 26 #include "extensions/browser/process_map.h" |
| 27 #include "extensions/common/constants.h" |
26 #include "ui/message_center/message_center.h" | 28 #include "ui/message_center/message_center.h" |
27 #include "ui/message_center/notification_list.h" | 29 #include "ui/message_center/notification_list.h" |
28 | 30 |
29 using content::NavigationController; | 31 using content::NavigationController; |
30 using content::WebContents; | 32 using content::WebContents; |
31 using extensions::Extension; | 33 using extensions::Extension; |
32 using extensions::ExtensionRegistry; | 34 using extensions::ExtensionRegistry; |
33 | 35 |
34 // Tests are timing out waiting for extension to crash. | 36 // Tests are timing out waiting for extension to crash. |
35 // http://crbug.com/174705 | 37 // http://crbug.com/174705 |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 // Regression test for issue 71629. | 523 // Regression test for issue 71629. |
522 IN_PROC_BROWSER_TEST_F(MAYBE_ExtensionCrashRecoveryTest, | 524 IN_PROC_BROWSER_TEST_F(MAYBE_ExtensionCrashRecoveryTest, |
523 MAYBE_ReloadTabsWithBackgroundPage) { | 525 MAYBE_ReloadTabsWithBackgroundPage) { |
524 TabStripModel* tab_strip = browser()->tab_strip_model(); | 526 TabStripModel* tab_strip = browser()->tab_strip_model(); |
525 const size_t count_before = GetEnabledExtensionCount(); | 527 const size_t count_before = GetEnabledExtensionCount(); |
526 const size_t crash_count_before = GetTerminatedExtensionCount(); | 528 const size_t crash_count_before = GetTerminatedExtensionCount(); |
527 LoadTestExtension(); | 529 LoadTestExtension(); |
528 | 530 |
529 // Open a tab extension. | 531 // Open a tab extension. |
530 chrome::NewTab(browser()); | 532 chrome::NewTab(browser()); |
531 ui_test_utils::NavigateToURL( | 533 ui_test_utils::NavigateToURL(browser(), |
532 browser(), | 534 GURL(std::string(extensions::kExtensionScheme) + |
533 GURL("chrome-extension://" + first_extension_id_ + "/background.html")); | 535 content::kStandardSchemeSeparator + |
| 536 first_extension_id_ + "/background.html")); |
534 | 537 |
535 const int tabs_before = tab_strip->count(); | 538 const int tabs_before = tab_strip->count(); |
536 CrashExtension(first_extension_id_); | 539 CrashExtension(first_extension_id_); |
537 | 540 |
538 // Tab should still be open, and extension should be crashed. | 541 // Tab should still be open, and extension should be crashed. |
539 EXPECT_EQ(tabs_before, tab_strip->count()); | 542 EXPECT_EQ(tabs_before, tab_strip->count()); |
540 EXPECT_EQ(count_before, GetEnabledExtensionCount()); | 543 EXPECT_EQ(count_before, GetEnabledExtensionCount()); |
541 EXPECT_EQ(crash_count_before + 1, GetTerminatedExtensionCount()); | 544 EXPECT_EQ(crash_count_before + 1, GetTerminatedExtensionCount()); |
542 | 545 |
543 { | 546 { |
544 content::WindowedNotificationObserver observer( | 547 content::WindowedNotificationObserver observer( |
545 content::NOTIFICATION_LOAD_STOP, | 548 content::NOTIFICATION_LOAD_STOP, |
546 content::Source<NavigationController>( | 549 content::Source<NavigationController>( |
547 &browser()->tab_strip_model()->GetActiveWebContents()-> | 550 &browser()->tab_strip_model()->GetActiveWebContents()-> |
548 GetController())); | 551 GetController())); |
549 chrome::Reload(browser(), CURRENT_TAB); | 552 chrome::Reload(browser(), CURRENT_TAB); |
550 observer.Wait(); | 553 observer.Wait(); |
551 } | 554 } |
552 // Extension should now be loaded. | 555 // Extension should now be loaded. |
553 SCOPED_TRACE("after reloading the tab"); | 556 SCOPED_TRACE("after reloading the tab"); |
554 CheckExtensionConsistency(first_extension_id_); | 557 CheckExtensionConsistency(first_extension_id_); |
555 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount()); | 558 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount()); |
556 ASSERT_EQ(0U, CountBalloons()); | 559 ASSERT_EQ(0U, CountBalloons()); |
557 } | 560 } |
OLD | NEW |