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/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" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 GetBackgroundHostForExtension(extension_id); | 65 GetBackgroundHostForExtension(extension_id); |
66 ASSERT_TRUE(extension_host); | 66 ASSERT_TRUE(extension_host); |
67 | 67 |
68 base::KillProcess(extension_host->render_process_host()->GetHandle(), | 68 base::KillProcess(extension_host->render_process_host()->GetHandle(), |
69 content::RESULT_CODE_KILLED, false); | 69 content::RESULT_CODE_KILLED, false); |
70 ASSERT_TRUE(WaitForExtensionCrash(extension_id)); | 70 ASSERT_TRUE(WaitForExtensionCrash(extension_id)); |
71 ASSERT_FALSE(GetExtensionProcessManager()-> | 71 ASSERT_FALSE(GetExtensionProcessManager()-> |
72 GetBackgroundHostForExtension(extension_id)); | 72 GetBackgroundHostForExtension(extension_id)); |
73 | 73 |
74 // Wait for extension crash balloon to appear. | 74 // Wait for extension crash balloon to appear. |
75 MessageLoop::current()->RunUntilIdle(); | 75 base::MessageLoop::current()->RunUntilIdle(); |
76 } | 76 } |
77 | 77 |
78 void CheckExtensionConsistency(std::string extension_id) { | 78 void CheckExtensionConsistency(std::string extension_id) { |
79 const Extension* extension = | 79 const Extension* extension = |
80 GetExtensionService()->extensions()->GetByID(extension_id); | 80 GetExtensionService()->extensions()->GetByID(extension_id); |
81 ASSERT_TRUE(extension); | 81 ASSERT_TRUE(extension); |
82 extensions::ExtensionHost* extension_host = GetExtensionProcessManager()-> | 82 extensions::ExtensionHost* extension_host = GetExtensionProcessManager()-> |
83 GetBackgroundHostForExtension(extension_id); | 83 GetBackgroundHostForExtension(extension_id); |
84 ASSERT_TRUE(extension_host); | 84 ASSERT_TRUE(extension_host); |
85 ExtensionProcessManager::ViewSet all_views = | 85 ExtensionProcessManager::ViewSet all_views = |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 GetExtensionService()->terminated_extensions()->size(); | 493 GetExtensionService()->terminated_extensions()->size(); |
494 LoadTestExtension(); | 494 LoadTestExtension(); |
495 LoadSecondExtension(); | 495 LoadSecondExtension(); |
496 CrashExtension(first_extension_id_); | 496 CrashExtension(first_extension_id_); |
497 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size()); | 497 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size()); |
498 ASSERT_EQ(crash_size_before + 1, | 498 ASSERT_EQ(crash_size_before + 1, |
499 GetExtensionService()->terminated_extensions()->size()); | 499 GetExtensionService()->terminated_extensions()->size()); |
500 | 500 |
501 ASSERT_EQ(1U, CountBalloons()); | 501 ASSERT_EQ(1U, CountBalloons()); |
502 UninstallExtension(first_extension_id_); | 502 UninstallExtension(first_extension_id_); |
503 MessageLoop::current()->RunUntilIdle(); | 503 base::MessageLoop::current()->RunUntilIdle(); |
504 | 504 |
505 SCOPED_TRACE("after uninstalling"); | 505 SCOPED_TRACE("after uninstalling"); |
506 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size()); | 506 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size()); |
507 ASSERT_EQ(crash_size_before, | 507 ASSERT_EQ(crash_size_before, |
508 GetExtensionService()->terminated_extensions()->size()); | 508 GetExtensionService()->terminated_extensions()->size()); |
509 ASSERT_EQ(0U, CountBalloons()); | 509 ASSERT_EQ(0U, CountBalloons()); |
510 } | 510 } |
511 | 511 |
512 // http://crbug.com/84719 | 512 // http://crbug.com/84719 |
513 #if defined(OS_LINUX) | 513 #if defined(OS_LINUX) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 GetController())); | 575 GetController())); |
576 chrome::Reload(browser(), CURRENT_TAB); | 576 chrome::Reload(browser(), CURRENT_TAB); |
577 observer.Wait(); | 577 observer.Wait(); |
578 } | 578 } |
579 // Extension should now be loaded. | 579 // Extension should now be loaded. |
580 SCOPED_TRACE("after reloading the tab"); | 580 SCOPED_TRACE("after reloading the tab"); |
581 CheckExtensionConsistency(first_extension_id_); | 581 CheckExtensionConsistency(first_extension_id_); |
582 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size()); | 582 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size()); |
583 ASSERT_EQ(0U, CountBalloons()); | 583 ASSERT_EQ(0U, CountBalloons()); |
584 } | 584 } |
OLD | NEW |