| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/android/offline_pages/prerendering_loader.h" | 5 #include "chrome/browser/android/offline_pages/prerendering_loader.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 PumpLoop(); | 236 PumpLoop(); |
| 237 EXPECT_TRUE(loader()->IsIdle()); | 237 EXPECT_TRUE(loader()->IsIdle()); |
| 238 EXPECT_FALSE(loader()->IsLoaded()); | 238 EXPECT_FALSE(loader()->IsLoaded()); |
| 239 EXPECT_EQ(Offliner::RequestStatus::PRERENDERING_CANCELED, | 239 EXPECT_EQ(Offliner::RequestStatus::PRERENDERING_CANCELED, |
| 240 callback_load_status()); | 240 callback_load_status()); |
| 241 EXPECT_FALSE(test_adapter()->IsActive()); | 241 EXPECT_FALSE(test_adapter()->IsActive()); |
| 242 } | 242 } |
| 243 | 243 |
| 244 TEST_F(PrerenderingLoaderTest, LoadPageLoadFailedNoContent) { | 244 TEST_F(PrerenderingLoaderTest, LoadPageLoadFailedNoContent) { |
| 245 test_adapter()->Configure(nullptr /* web_contents */, | 245 test_adapter()->Configure(nullptr /* web_contents */, |
| 246 prerender::FINAL_STATUS_MEMORY_LIMIT_EXCEEDED); | 246 prerender::FINAL_STATUS_CACHE_OR_HISTORY_CLEARED); |
| 247 GURL gurl("http://testit.sea"); | 247 GURL gurl("http://testit.sea"); |
| 248 EXPECT_TRUE(loader()->IsIdle()); | 248 EXPECT_TRUE(loader()->IsIdle()); |
| 249 EXPECT_TRUE(loader()->LoadPage( | 249 EXPECT_TRUE(loader()->LoadPage( |
| 250 gurl, | 250 gurl, |
| 251 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); | 251 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); |
| 252 EXPECT_FALSE(loader()->IsIdle()); | 252 EXPECT_FALSE(loader()->IsIdle()); |
| 253 EXPECT_FALSE(loader()->IsLoaded()); | 253 EXPECT_FALSE(loader()->IsLoaded()); |
| 254 | 254 |
| 255 test_adapter()->GetObserver()->OnPrerenderDomContentLoaded(); | 255 test_adapter()->GetObserver()->OnPrerenderDomContentLoaded(); |
| 256 PumpLoop(); | 256 PumpLoop(); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 test_adapter()->FailStart(); | 383 test_adapter()->FailStart(); |
| 384 GURL gurl("http://testit.sea"); | 384 GURL gurl("http://testit.sea"); |
| 385 EXPECT_TRUE(loader()->IsIdle()); | 385 EXPECT_TRUE(loader()->IsIdle()); |
| 386 EXPECT_FALSE(loader()->LoadPage( | 386 EXPECT_FALSE(loader()->LoadPage( |
| 387 gurl, | 387 gurl, |
| 388 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); | 388 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); |
| 389 EXPECT_TRUE(loader()->IsIdle()); | 389 EXPECT_TRUE(loader()->IsIdle()); |
| 390 } | 390 } |
| 391 | 391 |
| 392 } // namespace offline_pages | 392 } // namespace offline_pages |
| OLD | NEW |