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

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

Issue 1136553005: 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 EXPECT_TRUE(delegate.renderer_unresponsive_received()); 160 EXPECT_TRUE(delegate.renderer_unresponsive_received());
161 161
162 contents()->SetDelegate(NULL); 162 contents()->SetDelegate(NULL);
163 } 163 }
164 164
165 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) { 165 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) {
166 // Navigate to URL. First URL should use first RenderViewHost. 166 // Navigate to URL. First URL should use first RenderViewHost.
167 const GURL url("http://www.google.com"); 167 const GURL url("http://www.google.com");
168 controller().LoadURL( 168 controller().LoadURL(
169 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 169 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
170 int pending_id = controller().GetPendingEntry()->GetUniqueID();
171 contents()->GetMainFrame()->PrepareForCommit(); 170 contents()->GetMainFrame()->PrepareForCommit();
172 contents()->TestDidNavigate(contents()->GetMainFrame(), 1, pending_id, true, 171 contents()->TestDidNavigate(
173 url, ui::PAGE_TRANSITION_TYPED); 172 contents()->GetMainFrame(), 1, url, ui::PAGE_TRANSITION_TYPED);
174 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); 173 EXPECT_FALSE(contents()->CrossProcessNavigationPending());
175 174
176 TestDevToolsClientHost client_host; 175 TestDevToolsClientHost client_host;
177 client_host.InspectAgentHost( 176 client_host.InspectAgentHost(
178 DevToolsAgentHost::GetOrCreateFor(web_contents()).get()); 177 DevToolsAgentHost::GetOrCreateFor(web_contents()).get());
179 178
180 // Navigate to new site which should get a new RenderViewHost. 179 // Navigate to new site which should get a new RenderViewHost.
181 const GURL url2("http://www.yahoo.com"); 180 const GURL url2("http://www.yahoo.com");
182 controller().LoadURL( 181 controller().LoadURL(
183 url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 182 url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
184 contents()->GetMainFrame()->PrepareForCommit(); 183 contents()->GetMainFrame()->PrepareForCommit();
185 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); 184 EXPECT_TRUE(contents()->CrossProcessNavigationPending());
186 EXPECT_EQ(client_host.agent_host(), 185 EXPECT_EQ(client_host.agent_host(),
187 DevToolsAgentHost::GetOrCreateFor(web_contents()).get()); 186 DevToolsAgentHost::GetOrCreateFor(web_contents()).get());
188 187
189 // Interrupt pending navigation and navigate back to the original site. 188 // Interrupt pending navigation and navigate back to the original site.
190 controller().LoadURL( 189 controller().LoadURL(
191 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 190 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
192 pending_id = controller().GetPendingEntry()->GetUniqueID();
193 contents()->GetMainFrame()->PrepareForCommit(); 191 contents()->GetMainFrame()->PrepareForCommit();
194 contents()->TestDidNavigate(contents()->GetMainFrame(), 1, pending_id, false, 192 contents()->TestDidNavigate(
195 url, ui::PAGE_TRANSITION_TYPED); 193 contents()->GetMainFrame(), 1, url, ui::PAGE_TRANSITION_TYPED);
196 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); 194 EXPECT_FALSE(contents()->CrossProcessNavigationPending());
197 EXPECT_EQ(client_host.agent_host(), 195 EXPECT_EQ(client_host.agent_host(),
198 DevToolsAgentHost::GetOrCreateFor(web_contents()).get()); 196 DevToolsAgentHost::GetOrCreateFor(web_contents()).get());
199 client_host.Close(); 197 client_host.Close();
200 } 198 }
201 199
202 class TestExternalAgentDelegate: public DevToolsExternalAgentProxyDelegate { 200 class TestExternalAgentDelegate: public DevToolsExternalAgentProxyDelegate {
203 std::map<std::string,int> event_counter_; 201 std::map<std::string,int> event_counter_;
204 202
205 void recordEvent(const std::string& name) { 203 void recordEvent(const std::string& name) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 TestDevToolsClientHost client_host; 240 TestDevToolsClientHost client_host;
243 client_host.InspectAgentHost(agent_host.get()); 241 client_host.InspectAgentHost(agent_host.get());
244 agent_host->DispatchProtocolMessage("message1"); 242 agent_host->DispatchProtocolMessage("message1");
245 agent_host->DispatchProtocolMessage("message2"); 243 agent_host->DispatchProtocolMessage("message2");
246 agent_host->DispatchProtocolMessage("message2"); 244 agent_host->DispatchProtocolMessage("message2");
247 245
248 client_host.Close(); 246 client_host.Close();
249 } 247 }
250 248
251 } // namespace content 249 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698