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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "content/browser/devtools/devtools_manager_impl.h" | 8 #include "content/browser/devtools/devtools_manager_impl.h" |
9 #include "content/browser/devtools/render_view_devtools_agent_host.h" | 9 #include "content/browser/devtools/render_view_devtools_agent_host.h" |
10 #include "content/browser/renderer_host/test_render_view_host.h" | 10 #include "content/browser/renderer_host/test_render_view_host.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // Navigate to URL. First URL should use first RenderViewHost. | 204 // Navigate to URL. First URL should use first RenderViewHost. |
205 const GURL url("http://www.google.com"); | 205 const GURL url("http://www.google.com"); |
206 controller().LoadURL( | 206 controller().LoadURL( |
207 url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); | 207 url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); |
208 contents()->TestDidNavigate(rvh(), 1, url, PAGE_TRANSITION_TYPED); | 208 contents()->TestDidNavigate(rvh(), 1, url, PAGE_TRANSITION_TYPED); |
209 EXPECT_FALSE(contents()->cross_navigation_pending()); | 209 EXPECT_FALSE(contents()->cross_navigation_pending()); |
210 | 210 |
211 TestDevToolsClientHost client_host; | 211 TestDevToolsClientHost client_host; |
212 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); | 212 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); |
213 devtools_manager->RegisterDevToolsClientHostFor( | 213 devtools_manager->RegisterDevToolsClientHostFor( |
214 DevToolsAgentHost::GetOrCreateFor(rvh()), | 214 DevToolsAgentHost::GetOrCreateFor(rvh()).get(), &client_host); |
215 &client_host); | |
216 | 215 |
217 // Navigate to new site which should get a new RenderViewHost. | 216 // Navigate to new site which should get a new RenderViewHost. |
218 const GURL url2("http://www.yahoo.com"); | 217 const GURL url2("http://www.yahoo.com"); |
219 controller().LoadURL( | 218 controller().LoadURL( |
220 url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); | 219 url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); |
221 EXPECT_TRUE(contents()->cross_navigation_pending()); | 220 EXPECT_TRUE(contents()->cross_navigation_pending()); |
222 EXPECT_EQ(devtools_manager->GetDevToolsAgentHostFor(&client_host), | 221 EXPECT_EQ(devtools_manager->GetDevToolsAgentHostFor(&client_host), |
223 DevToolsAgentHost::GetOrCreateFor(pending_rvh())); | 222 DevToolsAgentHost::GetOrCreateFor(pending_rvh())); |
224 | 223 |
225 // Interrupt pending navigation and navigate back to the original site. | 224 // Interrupt pending navigation and navigate back to the original site. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 manager->RegisterDevToolsClientHostFor(agent_host.get(), &client_host); | 281 manager->RegisterDevToolsClientHostFor(agent_host.get(), &client_host); |
283 | 282 |
284 manager->DispatchOnInspectorBackend(&client_host, "message1"); | 283 manager->DispatchOnInspectorBackend(&client_host, "message1"); |
285 manager->DispatchOnInspectorBackend(&client_host, "message2"); | 284 manager->DispatchOnInspectorBackend(&client_host, "message2"); |
286 manager->DispatchOnInspectorBackend(&client_host, "message2"); | 285 manager->DispatchOnInspectorBackend(&client_host, "message2"); |
287 | 286 |
288 client_host.Close(manager); | 287 client_host.Close(manager); |
289 } | 288 } |
290 | 289 |
291 } // namespace content | 290 } // namespace content |
OLD | NEW |