| 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/time.h" | 7 #include "base/time/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/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 TestDevToolsClientHost client_host; | 168 TestDevToolsClientHost client_host; |
| 169 client_host.InspectAgentHost( | 169 client_host.InspectAgentHost( |
| 170 DevToolsAgentHost::GetOrCreateFor(web_contents()).get()); | 170 DevToolsAgentHost::GetOrCreateFor(web_contents()).get()); |
| 171 | 171 |
| 172 // Navigate to new site which should get a new RenderViewHost. | 172 // Navigate to new site which should get a new RenderViewHost. |
| 173 const GURL url2("http://www.yahoo.com"); | 173 const GURL url2("http://www.yahoo.com"); |
| 174 controller().LoadURL( | 174 controller().LoadURL( |
| 175 url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); | 175 url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); |
| 176 EXPECT_TRUE(contents()->cross_navigation_pending()); | 176 EXPECT_TRUE(contents()->cross_navigation_pending()); |
| 177 EXPECT_EQ(client_host.agent_host(), | 177 EXPECT_EQ(client_host.agent_host(), |
| 178 DevToolsAgentHost::GetOrCreateFor(web_contents())); | 178 DevToolsAgentHost::GetOrCreateFor(web_contents()).get()); |
| 179 | 179 |
| 180 // Interrupt pending navigation and navigate back to the original site. | 180 // Interrupt pending navigation and navigate back to the original site. |
| 181 controller().LoadURL( | 181 controller().LoadURL( |
| 182 url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); | 182 url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); |
| 183 contents()->TestDidNavigate( | 183 contents()->TestDidNavigate( |
| 184 contents()->GetMainFrame(), 1, url, PAGE_TRANSITION_TYPED); | 184 contents()->GetMainFrame(), 1, url, PAGE_TRANSITION_TYPED); |
| 185 EXPECT_FALSE(contents()->cross_navigation_pending()); | 185 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 186 EXPECT_EQ(client_host.agent_host(), | 186 EXPECT_EQ(client_host.agent_host(), |
| 187 DevToolsAgentHost::GetOrCreateFor(web_contents())); | 187 DevToolsAgentHost::GetOrCreateFor(web_contents()).get()); |
| 188 client_host.Close(); | 188 client_host.Close(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 class TestExternalAgentDelegate: public DevToolsExternalAgentProxyDelegate { | 191 class TestExternalAgentDelegate: public DevToolsExternalAgentProxyDelegate { |
| 192 std::map<std::string,int> event_counter_; | 192 std::map<std::string,int> event_counter_; |
| 193 | 193 |
| 194 void recordEvent(const std::string& name) { | 194 void recordEvent(const std::string& name) { |
| 195 if (event_counter_.find(name) == event_counter_.end()) | 195 if (event_counter_.find(name) == event_counter_.end()) |
| 196 event_counter_[name] = 0; | 196 event_counter_[name] = 0; |
| 197 event_counter_[name] = event_counter_[name] + 1; | 197 event_counter_[name] = event_counter_[name] + 1; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 TestDevToolsClientHost client_host; | 233 TestDevToolsClientHost client_host; |
| 234 client_host.InspectAgentHost(agent_host.get()); | 234 client_host.InspectAgentHost(agent_host.get()); |
| 235 agent_host->DispatchProtocolMessage("message1"); | 235 agent_host->DispatchProtocolMessage("message1"); |
| 236 agent_host->DispatchProtocolMessage("message2"); | 236 agent_host->DispatchProtocolMessage("message2"); |
| 237 agent_host->DispatchProtocolMessage("message2"); | 237 agent_host->DispatchProtocolMessage("message2"); |
| 238 | 238 |
| 239 client_host.Close(); | 239 client_host.Close(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace content | 242 } // namespace content |
| OLD | NEW |