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/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.h" |
7 #include "chrome/browser/extensions/extension_devtools_browsertest.h" | 7 #include "chrome/browser/extensions/extension_devtools_browsertest.h" |
8 #include "chrome/browser/extensions/extension_error_reporter.h" | 8 #include "chrome/browser/extensions/extension_error_reporter.h" |
9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
(...skipping 18 matching lines...) Expand all Loading... | |
29 using content::DevToolsManager; | 29 using content::DevToolsManager; |
30 using content::WebContents; | 30 using content::WebContents; |
31 | 31 |
32 // Looks for an ExtensionHost whose URL has the given path component (including | 32 // Looks for an ExtensionHost whose URL has the given path component (including |
33 // leading slash). Also verifies that the expected number of hosts are loaded. | 33 // leading slash). Also verifies that the expected number of hosts are loaded. |
34 static ExtensionHost* FindHostWithPath(ExtensionProcessManager* manager, | 34 static ExtensionHost* FindHostWithPath(ExtensionProcessManager* manager, |
35 const std::string& path, | 35 const std::string& path, |
36 int expected_hosts) { | 36 int expected_hosts) { |
37 ExtensionHost* host = NULL; | 37 ExtensionHost* host = NULL; |
38 int num_hosts = 0; | 38 int num_hosts = 0; |
39 for (ExtensionProcessManager::const_iterator iter = manager->begin(); | 39 ExtensionProcessManager::ExtensionHostSet background_hosts = |
Aaron Boodman
2012/04/20 06:34:56
This doesn't do the same thing, but I guess all th
benwells
2012/04/23 05:00:26
Renamed to be clear its background pages.
| |
40 iter != manager->end(); ++iter) { | 40 manager->background_hosts(); |
41 for (ExtensionProcessManager::const_iterator iter = background_hosts.begin(); | |
42 iter != background_hosts.end(); ++iter) { | |
41 if ((*iter)->GetURL().path() == path) { | 43 if ((*iter)->GetURL().path() == path) { |
42 EXPECT_FALSE(host); | 44 EXPECT_FALSE(host); |
43 host = *iter; | 45 host = *iter; |
44 } | 46 } |
45 num_hosts++; | 47 num_hosts++; |
46 } | 48 } |
47 EXPECT_EQ(expected_hosts, num_hosts); | 49 EXPECT_EQ(expected_hosts, num_hosts); |
48 EXPECT_TRUE(host); | 50 EXPECT_TRUE(host); |
49 return host; | 51 return host; |
50 } | 52 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 // Removing the listeners from the second extension should tear the bridge | 160 // Removing the listeners from the second extension should tear the bridge |
159 // down. | 161 // down. |
160 result = false; | 162 result = false; |
161 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 163 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
162 host_two->render_view_host(), L"", L"unregisterListeners()", &result)); | 164 host_two->render_view_host(), L"", L"unregisterListeners()", &result)); |
163 EXPECT_TRUE(result); | 165 EXPECT_TRUE(result); |
164 ASSERT_FALSE(devtools_manager->GetDevToolsClientHostFor( | 166 ASSERT_FALSE(devtools_manager->GetDevToolsClientHostFor( |
165 DevToolsAgentHostRegistry::GetDevToolsAgentHost( | 167 DevToolsAgentHostRegistry::GetDevToolsAgentHost( |
166 web_contents->GetRenderViewHost()))); | 168 web_contents->GetRenderViewHost()))); |
167 } | 169 } |
OLD | NEW |