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 <map> | 5 #include <map> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 } | 370 } |
371 | 371 |
372 void DisablePrerender() { | 372 void DisablePrerender() { |
373 profile_.GetPrefs()->SetInteger( | 373 profile_.GetPrefs()->SetInteger( |
374 prefs::kNetworkPredictionOptions, | 374 prefs::kNetworkPredictionOptions, |
375 chrome_browser_net::NETWORK_PREDICTION_NEVER); | 375 chrome_browser_net::NETWORK_PREDICTION_NEVER); |
376 } | 376 } |
377 | 377 |
378 private: | 378 private: |
379 // Needed to pass PrerenderManager's DCHECKs. | 379 // Needed to pass PrerenderManager's DCHECKs. |
| 380 base::MessageLoop message_loop_; |
380 TestingProfile profile_; | 381 TestingProfile profile_; |
381 base::MessageLoop message_loop_; | |
382 content::TestBrowserThread ui_thread_; | 382 content::TestBrowserThread ui_thread_; |
383 scoped_ptr<UnitTestPrerenderManager> prerender_manager_; | 383 scoped_ptr<UnitTestPrerenderManager> prerender_manager_; |
384 scoped_ptr<PrerenderLinkManager> prerender_link_manager_; | 384 scoped_ptr<PrerenderLinkManager> prerender_link_manager_; |
385 int last_prerender_id_; | 385 int last_prerender_id_; |
386 base::FieldTrialList field_trial_list_; | 386 base::FieldTrialList field_trial_list_; |
387 }; | 387 }; |
388 | 388 |
389 TEST_F(PrerenderTest, PrerenderRespectsDisableFlag) { | 389 TEST_F(PrerenderTest, PrerenderRespectsDisableFlag) { |
390 RestorePrerenderMode restore_prerender_mode; | 390 RestorePrerenderMode restore_prerender_mode; |
391 ASSERT_TRUE(PrerenderManager::IsPrerenderingPossible()); | 391 ASSERT_TRUE(PrerenderManager::IsPrerenderingPossible()); |
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 CHECK(prerender_handle.get()); | 1563 CHECK(prerender_handle.get()); |
1564 EXPECT_TRUE(prerender_handle->IsPrerendering()); | 1564 EXPECT_TRUE(prerender_handle->IsPrerendering()); |
1565 EXPECT_TRUE(prerender_contents->prerendering_has_started()); | 1565 EXPECT_TRUE(prerender_contents->prerendering_has_started()); |
1566 EXPECT_EQ(prerender_contents, prerender_handle->contents()); | 1566 EXPECT_EQ(prerender_contents, prerender_handle->contents()); |
1567 EXPECT_EQ(ORIGIN_INSTANT, prerender_handle->contents()->origin()); | 1567 EXPECT_EQ(ORIGIN_INSTANT, prerender_handle->contents()->origin()); |
1568 ASSERT_EQ(prerender_contents, prerender_manager()->FindAndUseEntry(url)); | 1568 ASSERT_EQ(prerender_contents, prerender_manager()->FindAndUseEntry(url)); |
1569 EXPECT_FALSE(prerender_handle->IsPrerendering()); | 1569 EXPECT_FALSE(prerender_handle->IsPrerendering()); |
1570 } | 1570 } |
1571 | 1571 |
1572 } // namespace prerender | 1572 } // namespace prerender |
OLD | NEW |