| 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" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 void CrashExtension(const std::string& extension_id) { | 71 void CrashExtension(const std::string& extension_id) { |
| 72 const Extension* extension = GetExtensionRegistry()->GetExtensionById( | 72 const Extension* extension = GetExtensionRegistry()->GetExtensionById( |
| 73 extension_id, ExtensionRegistry::ENABLED); | 73 extension_id, ExtensionRegistry::ENABLED); |
| 74 ASSERT_TRUE(extension); | 74 ASSERT_TRUE(extension); |
| 75 extensions::ExtensionHost* extension_host = GetProcessManager()-> | 75 extensions::ExtensionHost* extension_host = GetProcessManager()-> |
| 76 GetBackgroundHostForExtension(extension_id); | 76 GetBackgroundHostForExtension(extension_id); |
| 77 ASSERT_TRUE(extension_host); | 77 ASSERT_TRUE(extension_host); |
| 78 | 78 |
| 79 base::KillProcess(extension_host->render_process_host()->GetHandle(), | 79 extension_host->render_process_host()->Shutdown(content::RESULT_CODE_KILLED, |
| 80 content::RESULT_CODE_KILLED, false); | 80 false); |
| 81 ASSERT_TRUE(WaitForExtensionCrash(extension_id)); | 81 ASSERT_TRUE(WaitForExtensionCrash(extension_id)); |
| 82 ASSERT_FALSE(GetProcessManager()-> | 82 ASSERT_FALSE(GetProcessManager()-> |
| 83 GetBackgroundHostForExtension(extension_id)); | 83 GetBackgroundHostForExtension(extension_id)); |
| 84 | 84 |
| 85 // Wait for extension crash balloon to appear. | 85 // Wait for extension crash balloon to appear. |
| 86 base::MessageLoop::current()->RunUntilIdle(); | 86 base::MessageLoop::current()->RunUntilIdle(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void CheckExtensionConsistency(const std::string& extension_id) { | 89 void CheckExtensionConsistency(const std::string& extension_id) { |
| 90 const Extension* extension = GetExtensionRegistry()->GetExtensionById( | 90 const Extension* extension = GetExtensionRegistry()->GetExtensionById( |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 GetController())); | 552 GetController())); |
| 553 chrome::Reload(browser(), CURRENT_TAB); | 553 chrome::Reload(browser(), CURRENT_TAB); |
| 554 observer.Wait(); | 554 observer.Wait(); |
| 555 } | 555 } |
| 556 // Extension should now be loaded. | 556 // Extension should now be loaded. |
| 557 SCOPED_TRACE("after reloading the tab"); | 557 SCOPED_TRACE("after reloading the tab"); |
| 558 CheckExtensionConsistency(first_extension_id_); | 558 CheckExtensionConsistency(first_extension_id_); |
| 559 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount()); | 559 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount()); |
| 560 ASSERT_EQ(0U, CountBalloons()); | 560 ASSERT_EQ(0U, CountBalloons()); |
| 561 } | 561 } |
| OLD | NEW |