Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: chrome/browser/extensions/extension_devtools_browsertests.cc

Issue 11246003: Remove Profile->GetExtensionProcessManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix extension_crash_recovery_browsertest Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/extension_system.h"
12 #include "chrome/browser/extensions/extension_tab_util.h" 13 #include "chrome/browser/extensions/extension_tab_util.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_list.h" 16 #include "chrome/browser/ui/browser_list.h"
16 #include "chrome/browser/ui/browser_tabstrip.h" 17 #include "chrome/browser/ui/browser_tabstrip.h"
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
18 #include "chrome/common/chrome_paths.h" 19 #include "chrome/common/chrome_paths.h"
19 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
20 #include "chrome/test/base/ui_test_utils.h" 21 #include "chrome/test/base/ui_test_utils.h"
21 #include "content/public/browser/devtools_agent_host_registry.h" 22 #include "content/public/browser/devtools_agent_host_registry.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 return host; 58 return host;
58 } 59 }
59 60
60 // Tests for the experimental timeline extensions API. 61 // Tests for the experimental timeline extensions API.
61 IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, TimelineApi) { 62 IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, TimelineApi) {
62 ASSERT_TRUE(LoadExtension( 63 ASSERT_TRUE(LoadExtension(
63 test_data_dir_.AppendASCII("devtools").AppendASCII("timeline_api"))); 64 test_data_dir_.AppendASCII("devtools").AppendASCII("timeline_api")));
64 65
65 // Get the ExtensionHost that is hosting our background page. 66 // Get the ExtensionHost that is hosting our background page.
66 ExtensionProcessManager* manager = 67 ExtensionProcessManager* manager =
67 browser()->profile()->GetExtensionProcessManager(); 68 extensions::ExtensionSystem::Get(browser()->profile())->process_manager();
68 ExtensionHost* host = FindBackgroundHostWithPath(manager, 69 ExtensionHost* host = FindBackgroundHostWithPath(manager,
69 "/background.html", 1); 70 "/background.html", 1);
70 71
71 // Grab a handle to the DevToolsManager so we can forward messages to it. 72 // Grab a handle to the DevToolsManager so we can forward messages to it.
72 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); 73 DevToolsManager* devtools_manager = DevToolsManager::GetInstance();
73 74
74 // Grab the tab_id of whatever tab happens to be first. 75 // Grab the tab_id of whatever tab happens to be first.
75 WebContents* web_contents = chrome::GetWebContentsAt(browser(), 0); 76 WebContents* web_contents = chrome::GetWebContentsAt(browser(), 0);
76 ASSERT_TRUE(web_contents); 77 ASSERT_TRUE(web_contents);
77 int tab_id = ExtensionTabUtil::GetTabId(web_contents); 78 int tab_id = ExtensionTabUtil::GetTabId(web_contents);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 112 }
112 113
113 114
114 // Tests that ref counting of listeners from multiple processes works. 115 // Tests that ref counting of listeners from multiple processes works.
115 IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, ProcessRefCounting) { 116 IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, ProcessRefCounting) {
116 ASSERT_TRUE(LoadExtension( 117 ASSERT_TRUE(LoadExtension(
117 test_data_dir_.AppendASCII("devtools").AppendASCII("timeline_api"))); 118 test_data_dir_.AppendASCII("devtools").AppendASCII("timeline_api")));
118 119
119 // Get the ExtensionHost that is hosting our background page. 120 // Get the ExtensionHost that is hosting our background page.
120 ExtensionProcessManager* manager = 121 ExtensionProcessManager* manager =
121 browser()->profile()->GetExtensionProcessManager(); 122 extensions::ExtensionSystem::Get(browser()->profile())->process_manager();
122 ExtensionHost* host_one = FindBackgroundHostWithPath(manager, 123 ExtensionHost* host_one = FindBackgroundHostWithPath(manager,
123 "/background.html", 1); 124 "/background.html", 1);
124 125
125 ASSERT_TRUE(LoadExtension( 126 ASSERT_TRUE(LoadExtension(
126 test_data_dir_.AppendASCII("devtools").AppendASCII("timeline_api_two"))); 127 test_data_dir_.AppendASCII("devtools").AppendASCII("timeline_api_two")));
127 ExtensionHost* host_two = FindBackgroundHostWithPath(manager, 128 ExtensionHost* host_two = FindBackgroundHostWithPath(manager,
128 "/background_two.html", 129 "/background_two.html",
129 2); 130 2);
130 131
131 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); 132 DevToolsManager* devtools_manager = DevToolsManager::GetInstance();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // Removing the listeners from the second extension should tear the bridge 170 // Removing the listeners from the second extension should tear the bridge
170 // down. 171 // down.
171 result = false; 172 result = false;
172 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( 173 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool(
173 host_two->render_view_host(), L"", L"unregisterListeners()", &result)); 174 host_two->render_view_host(), L"", L"unregisterListeners()", &result));
174 EXPECT_TRUE(result); 175 EXPECT_TRUE(result);
175 ASSERT_FALSE(devtools_manager->GetDevToolsClientHostFor( 176 ASSERT_FALSE(devtools_manager->GetDevToolsClientHostFor(
176 DevToolsAgentHostRegistry::GetDevToolsAgentHost( 177 DevToolsAgentHostRegistry::GetDevToolsAgentHost(
177 web_contents->GetRenderViewHost()))); 178 web_contents->GetRenderViewHost())));
178 } 179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698