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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 GetBackgroundHostForExtension(extension_id)); | 85 GetBackgroundHostForExtension(extension_id)); |
86 } | 86 } |
87 | 87 |
88 void CheckExtensionConsistency(std::string extension_id) { | 88 void CheckExtensionConsistency(std::string extension_id) { |
89 const Extension* extension = | 89 const Extension* extension = |
90 GetExtensionService()->extensions()->GetByID(extension_id); | 90 GetExtensionService()->extensions()->GetByID(extension_id); |
91 ASSERT_TRUE(extension); | 91 ASSERT_TRUE(extension); |
92 ExtensionHost* extension_host = GetExtensionProcessManager()-> | 92 ExtensionHost* extension_host = GetExtensionProcessManager()-> |
93 GetBackgroundHostForExtension(extension_id); | 93 GetBackgroundHostForExtension(extension_id); |
94 ASSERT_TRUE(extension_host); | 94 ASSERT_TRUE(extension_host); |
95 ASSERT_TRUE(GetExtensionProcessManager()->HasExtensionHost(extension_host)); | 95 ExtensionProcessManager::ViewSet all_views = |
| 96 GetExtensionProcessManager()->GetAllViews(); |
| 97 ExtensionProcessManager::ViewSet::const_iterator it = |
| 98 all_views.find(extension_host->host_contents()->GetRenderViewHost()); |
| 99 ASSERT_FALSE(it == all_views.end()); |
96 ASSERT_TRUE(extension_host->IsRenderViewLive()); | 100 ASSERT_TRUE(extension_host->IsRenderViewLive()); |
97 extensions::ProcessMap* process_map = | 101 extensions::ProcessMap* process_map = |
98 browser()->profile()->GetExtensionService()->process_map(); | 102 browser()->profile()->GetExtensionService()->process_map(); |
99 ASSERT_TRUE(process_map->Contains( | 103 ASSERT_TRUE(process_map->Contains( |
100 extension_id, | 104 extension_id, |
101 extension_host->render_view_host()->GetProcess()->GetID())); | 105 extension_host->render_view_host()->GetProcess()->GetID())); |
102 } | 106 } |
103 | 107 |
104 void LoadTestExtension() { | 108 void LoadTestExtension() { |
105 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); | 109 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 GetController())); | 487 GetController())); |
484 browser()->Reload(CURRENT_TAB); | 488 browser()->Reload(CURRENT_TAB); |
485 observer.Wait(); | 489 observer.Wait(); |
486 } | 490 } |
487 // Extension should now be loaded. | 491 // Extension should now be loaded. |
488 SCOPED_TRACE("after reloading the tab"); | 492 SCOPED_TRACE("after reloading the tab"); |
489 CheckExtensionConsistency(first_extension_id_); | 493 CheckExtensionConsistency(first_extension_id_); |
490 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size()); | 494 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size()); |
491 ASSERT_EQ(0U, CountBalloons()); | 495 ASSERT_EQ(0U, CountBalloons()); |
492 } | 496 } |
OLD | NEW |