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

Side by Side Diff: chrome/browser/prerender/prerender_manager_unittest.cc

Issue 9623018: Prerendered pages are swapped in at browser::Navigate time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "chrome/browser/prerender/prerender_contents.h" 9 #include "chrome/browser/prerender/prerender_contents.h"
10 #include "chrome/browser/prerender/prerender_manager.h" 10 #include "chrome/browser/prerender/prerender_manager.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 229
230 // Needed to pass PrerenderManager's DCHECKs. 230 // Needed to pass PrerenderManager's DCHECKs.
231 MessageLoop message_loop_; 231 MessageLoop message_loop_;
232 content::TestBrowserThread ui_thread_; 232 content::TestBrowserThread ui_thread_;
233 scoped_ptr<TestPrerenderManager> prerender_manager_; 233 scoped_ptr<TestPrerenderManager> prerender_manager_;
234 }; 234 };
235 235
236 TEST_F(PrerenderManagerTest, EmptyTest) { 236 TEST_F(PrerenderManagerTest, EmptyTest) {
237 EXPECT_FALSE(prerender_manager()->MaybeUsePrerenderedPage( 237 EXPECT_FALSE(prerender_manager()->MaybeUsePrerenderedPage(
238 NULL, 238 NULL,
239 GURL("http://www.google.com/"), 239 GURL("http://www.google.com/")));
240 GURL()));
241
242 EXPECT_FALSE(prerender_manager()->MaybeUsePrerenderedPage(
243 NULL,
244 GURL("http://www.google.com/search"),
245 GURL("http://www.google.com")));
246 } 240 }
247 241
248 TEST_F(PrerenderManagerTest, FoundTest) { 242 TEST_F(PrerenderManagerTest, FoundTest) {
249 GURL url("http://www.google.com/"); 243 GURL url("http://www.google.com/");
250 DummyPrerenderContents* prerender_contents = 244 DummyPrerenderContents* prerender_contents =
251 prerender_manager()->CreateNextPrerenderContents( 245 prerender_manager()->CreateNextPrerenderContents(
252 url, 246 url,
253 FINAL_STATUS_USED); 247 FINAL_STATUS_USED);
254 EXPECT_TRUE(prerender_manager()->AddSimplePrerender(url)); 248 EXPECT_TRUE(prerender_manager()->AddSimplePrerender(url));
255 EXPECT_TRUE(prerender_contents->has_started()); 249 EXPECT_TRUE(prerender_contents->has_started());
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 prerender_manager()->CreateNextPrerenderContents( 580 prerender_manager()->CreateNextPrerenderContents(
587 url, ORIGIN_LINK_REL_PRERENDER, FINAL_STATUS_MANAGER_SHUTDOWN); 581 url, ORIGIN_LINK_REL_PRERENDER, FINAL_STATUS_MANAGER_SHUTDOWN);
588 EXPECT_TRUE(prerender_manager()->AddSimplePrerender(url)); 582 EXPECT_TRUE(prerender_manager()->AddSimplePrerender(url));
589 EXPECT_TRUE(prerender_contents->has_started()); 583 EXPECT_TRUE(prerender_contents->has_started());
590 prerender_manager()->CancelOmniboxPrerenders(); 584 prerender_manager()->CancelOmniboxPrerenders();
591 const DummyPrerenderContents* null = NULL; 585 const DummyPrerenderContents* null = NULL;
592 EXPECT_NE(null, prerender_manager()->FindEntry(url)); 586 EXPECT_NE(null, prerender_manager()->FindEntry(url));
593 } 587 }
594 588
595 } // namespace prerender 589 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698