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

Side by Side Diff: content/browser/devtools/devtools_manager_unittest.cc

Issue 1110943003: Revert of Classify navigations without page id in parallel to the existing classifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months 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
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/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/shared_worker_devtools_manager.h" 9 #include "content/browser/devtools/shared_worker_devtools_manager.h"
10 #include "content/browser/shared_worker/shared_worker_instance.h" 10 #include "content/browser/shared_worker/shared_worker_instance.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 EXPECT_TRUE(delegate.renderer_unresponsive_received()); 244 EXPECT_TRUE(delegate.renderer_unresponsive_received());
245 245
246 contents()->SetDelegate(NULL); 246 contents()->SetDelegate(NULL);
247 } 247 }
248 248
249 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) { 249 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) {
250 // Navigate to URL. First URL should use first RenderViewHost. 250 // Navigate to URL. First URL should use first RenderViewHost.
251 const GURL url("http://www.google.com"); 251 const GURL url("http://www.google.com");
252 controller().LoadURL( 252 controller().LoadURL(
253 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 253 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
254 int pending_id = controller().GetPendingEntry()->GetUniqueID();
255 contents()->GetMainFrame()->PrepareForCommit(); 254 contents()->GetMainFrame()->PrepareForCommit();
256 contents()->TestDidNavigate(contents()->GetMainFrame(), 1, pending_id, true, 255 contents()->TestDidNavigate(
257 url, ui::PAGE_TRANSITION_TYPED); 256 contents()->GetMainFrame(), 1, url, ui::PAGE_TRANSITION_TYPED);
258 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); 257 EXPECT_FALSE(contents()->CrossProcessNavigationPending());
259 258
260 TestDevToolsClientHost client_host; 259 TestDevToolsClientHost client_host;
261 client_host.InspectAgentHost( 260 client_host.InspectAgentHost(
262 DevToolsAgentHost::GetOrCreateFor(web_contents()).get()); 261 DevToolsAgentHost::GetOrCreateFor(web_contents()).get());
263 262
264 // Navigate to new site which should get a new RenderViewHost. 263 // Navigate to new site which should get a new RenderViewHost.
265 const GURL url2("http://www.yahoo.com"); 264 const GURL url2("http://www.yahoo.com");
266 controller().LoadURL( 265 controller().LoadURL(
267 url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 266 url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
268 contents()->GetMainFrame()->PrepareForCommit(); 267 contents()->GetMainFrame()->PrepareForCommit();
269 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); 268 EXPECT_TRUE(contents()->CrossProcessNavigationPending());
270 EXPECT_EQ(client_host.agent_host(), 269 EXPECT_EQ(client_host.agent_host(),
271 DevToolsAgentHost::GetOrCreateFor(web_contents()).get()); 270 DevToolsAgentHost::GetOrCreateFor(web_contents()).get());
272 271
273 // Interrupt pending navigation and navigate back to the original site. 272 // Interrupt pending navigation and navigate back to the original site.
274 controller().LoadURL( 273 controller().LoadURL(
275 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 274 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
276 pending_id = controller().GetPendingEntry()->GetUniqueID();
277 contents()->GetMainFrame()->PrepareForCommit(); 275 contents()->GetMainFrame()->PrepareForCommit();
278 contents()->TestDidNavigate(contents()->GetMainFrame(), 1, pending_id, false, 276 contents()->TestDidNavigate(
279 url, ui::PAGE_TRANSITION_TYPED); 277 contents()->GetMainFrame(), 1, url, ui::PAGE_TRANSITION_TYPED);
280 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); 278 EXPECT_FALSE(contents()->CrossProcessNavigationPending());
281 EXPECT_EQ(client_host.agent_host(), 279 EXPECT_EQ(client_host.agent_host(),
282 DevToolsAgentHost::GetOrCreateFor(web_contents()).get()); 280 DevToolsAgentHost::GetOrCreateFor(web_contents()).get());
283 client_host.Close(); 281 client_host.Close();
284 } 282 }
285 283
286 class TestExternalAgentDelegate: public DevToolsExternalAgentProxyDelegate { 284 class TestExternalAgentDelegate: public DevToolsExternalAgentProxyDelegate {
287 std::map<std::string,int> event_counter_; 285 std::map<std::string,int> event_counter_;
288 286
289 void recordEvent(const std::string& name) { 287 void recordEvent(const std::string& name) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 TestDevToolsClientHost client_host; 324 TestDevToolsClientHost client_host;
327 client_host.InspectAgentHost(agent_host.get()); 325 client_host.InspectAgentHost(agent_host.get());
328 agent_host->DispatchProtocolMessage("message1"); 326 agent_host->DispatchProtocolMessage("message1");
329 agent_host->DispatchProtocolMessage("message2"); 327 agent_host->DispatchProtocolMessage("message2");
330 agent_host->DispatchProtocolMessage("message2"); 328 agent_host->DispatchProtocolMessage("message2");
331 329
332 client_host.Close(); 330 client_host.Close();
333 } 331 }
334 332
335 } // namespace content 333 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698