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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/format_macros.h" | 6 #include "base/format_macros.h" |
7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 return LauncherHasRunningPrerender(kDefaultChildId, last_prerender_id()); | 342 return LauncherHasRunningPrerender(kDefaultChildId, last_prerender_id()); |
343 } | 343 } |
344 | 344 |
345 private: | 345 private: |
346 PrerenderTracker* prerender_tracker() { | 346 PrerenderTracker* prerender_tracker() { |
347 return g_browser_process->prerender_tracker(); | 347 return g_browser_process->prerender_tracker(); |
348 } | 348 } |
349 | 349 |
350 // Needed to pass PrerenderManager's DCHECKs. | 350 // Needed to pass PrerenderManager's DCHECKs. |
351 TestingProfile profile_; | 351 TestingProfile profile_; |
352 MessageLoop message_loop_; | 352 base::MessageLoop message_loop_; |
353 content::TestBrowserThread ui_thread_; | 353 content::TestBrowserThread ui_thread_; |
354 scoped_ptr<UnitTestPrerenderManager> prerender_manager_; | 354 scoped_ptr<UnitTestPrerenderManager> prerender_manager_; |
355 scoped_ptr<PrerenderLinkManager> prerender_link_manager_; | 355 scoped_ptr<PrerenderLinkManager> prerender_link_manager_; |
356 int last_prerender_id_; | 356 int last_prerender_id_; |
357 }; | 357 }; |
358 | 358 |
359 TEST_F(PrerenderTest, FoundTest) { | 359 TEST_F(PrerenderTest, FoundTest) { |
360 GURL url("http://www.google.com/"); | 360 GURL url("http://www.google.com/"); |
361 DummyPrerenderContents* prerender_contents = | 361 DummyPrerenderContents* prerender_contents = |
362 prerender_manager()->CreateNextPrerenderContents( | 362 prerender_manager()->CreateNextPrerenderContents( |
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 EXPECT_EQ(null, prerender_manager()->FindEntry(second_url)); | 1415 EXPECT_EQ(null, prerender_manager()->FindEntry(second_url)); |
1416 | 1416 |
1417 // The first prerender should have died, giving life to the second one. | 1417 // The first prerender should have died, giving life to the second one. |
1418 prerender_manager()->AdvanceTimeTicks(wait_for_first_prerender_to_expire); | 1418 prerender_manager()->AdvanceTimeTicks(wait_for_first_prerender_to_expire); |
1419 EXPECT_EQ(null, prerender_manager()->FindEntry(first_url)); | 1419 EXPECT_EQ(null, prerender_manager()->FindEntry(first_url)); |
1420 EXPECT_EQ(second_prerender_contents, | 1420 EXPECT_EQ(second_prerender_contents, |
1421 prerender_manager()->FindAndUseEntry(second_url)); | 1421 prerender_manager()->FindAndUseEntry(second_url)); |
1422 } | 1422 } |
1423 | 1423 |
1424 } // namespace prerender | 1424 } // namespace prerender |
OLD | NEW |