OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/process_util.h" | 5 #include "base/process_util.h" |
6 #include "chrome/browser/browser_process.h" | 6 #include "chrome/browser/browser_process.h" |
7 #include "chrome/browser/extensions/extension_browsertest.h" | 7 #include "chrome/browser/extensions/extension_browsertest.h" |
8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
9 #include "chrome/browser/extensions/extension_process_manager.h" | 9 #include "chrome/browser/extensions/extension_process_manager.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/notifications/balloon_host.h" | 11 #include "chrome/browser/notifications/balloon_host.h" |
12 #include "chrome/browser/notifications/notification.h" | 12 #include "chrome/browser/notifications/notification.h" |
13 #include "chrome/browser/notifications/notification_delegate.h" | 13 #include "chrome/browser/notifications/notification_delegate.h" |
14 #include "chrome/browser/notifications/notification_ui_manager.h" | 14 #include "chrome/browser/notifications/notification_ui_manager.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/tabs/tab_strip_model.h" | 16 #include "chrome/browser/tabs/tab_strip_model.h" |
17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
19 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
20 #include "content/browser/renderer_host/render_view_host.h" | 20 #include "content/browser/renderer_host/render_view_host.h" |
21 #include "content/public/browser/navigation_controller.h" | 21 #include "content/public/browser/navigation_controller.h" |
22 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
23 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
24 #include "content/public/common/result_codes.h" | 24 #include "content/public/common/result_codes.h" |
25 | 25 |
| 26 using content::NavigationController; |
26 using content::WebContents; | 27 using content::WebContents; |
27 | 28 |
28 class ExtensionCrashRecoveryTest : public ExtensionBrowserTest { | 29 class ExtensionCrashRecoveryTest : public ExtensionBrowserTest { |
29 protected: | 30 protected: |
30 ExtensionService* GetExtensionService() { | 31 ExtensionService* GetExtensionService() { |
31 return browser()->profile()->GetExtensionService(); | 32 return browser()->profile()->GetExtensionService(); |
32 } | 33 } |
33 | 34 |
34 ExtensionProcessManager* GetExtensionProcessManager() { | 35 ExtensionProcessManager* GetExtensionProcessManager() { |
35 return browser()->profile()->GetExtensionProcessManager(); | 36 return browser()->profile()->GetExtensionProcessManager(); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 | 468 |
468 // Tab should still be open, and extension should be crashed. | 469 // Tab should still be open, and extension should be crashed. |
469 EXPECT_EQ(tabs_before, tab_strip->count()); | 470 EXPECT_EQ(tabs_before, tab_strip->count()); |
470 EXPECT_EQ(size_before, GetExtensionService()->extensions()->size()); | 471 EXPECT_EQ(size_before, GetExtensionService()->extensions()->size()); |
471 EXPECT_EQ(crash_size_before + 1, | 472 EXPECT_EQ(crash_size_before + 1, |
472 GetExtensionService()->terminated_extensions()->size()); | 473 GetExtensionService()->terminated_extensions()->size()); |
473 | 474 |
474 { | 475 { |
475 ui_test_utils::WindowedNotificationObserver observer( | 476 ui_test_utils::WindowedNotificationObserver observer( |
476 content::NOTIFICATION_LOAD_STOP, | 477 content::NOTIFICATION_LOAD_STOP, |
477 content::Source<content::NavigationController>( | 478 content::Source<NavigationController>( |
478 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> | 479 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> |
479 GetController())); | 480 GetController())); |
480 browser()->Reload(CURRENT_TAB); | 481 browser()->Reload(CURRENT_TAB); |
481 observer.Wait(); | 482 observer.Wait(); |
482 } | 483 } |
483 // Extension should now be loaded. | 484 // Extension should now be loaded. |
484 SCOPED_TRACE("after reloading the tab"); | 485 SCOPED_TRACE("after reloading the tab"); |
485 CheckExtensionConsistency(first_extension_id_); | 486 CheckExtensionConsistency(first_extension_id_); |
486 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size()); | 487 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size()); |
487 ASSERT_EQ(0U, CountBalloons()); | 488 ASSERT_EQ(0U, CountBalloons()); |
488 } | 489 } |
OLD | NEW |