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.h" | 8 #include "content/browser/devtools/devtools_manager.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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 base::MessageLoop::current()->Run(); | 153 base::MessageLoop::current()->Run(); |
154 EXPECT_TRUE(delegate.renderer_unresponsive_received()); | 154 EXPECT_TRUE(delegate.renderer_unresponsive_received()); |
155 | 155 |
156 contents()->SetDelegate(NULL); | 156 contents()->SetDelegate(NULL); |
157 } | 157 } |
158 | 158 |
159 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) { | 159 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) { |
160 // Navigate to URL. First URL should use first RenderViewHost. | 160 // Navigate to URL. First URL should use first RenderViewHost. |
161 const GURL url("http://www.google.com"); | 161 const GURL url("http://www.google.com"); |
162 controller().LoadURL( | 162 controller().LoadURL( |
163 url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); | 163 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
164 contents()->TestDidNavigate( | 164 contents()->TestDidNavigate( |
165 contents()->GetMainFrame(), 1, url, PAGE_TRANSITION_TYPED); | 165 contents()->GetMainFrame(), 1, url, ui::PAGE_TRANSITION_TYPED); |
166 EXPECT_FALSE(contents()->cross_navigation_pending()); | 166 EXPECT_FALSE(contents()->cross_navigation_pending()); |
167 | 167 |
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(), ui::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()).get()); | 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(), ui::PAGE_TRANSITION_TYPED, std::string()); |
183 contents()->TestDidNavigate( | 183 contents()->TestDidNavigate( |
184 contents()->GetMainFrame(), 1, url, PAGE_TRANSITION_TYPED); | 184 contents()->GetMainFrame(), 1, url, ui::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()).get()); | 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) { |
(...skipping 38 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 |