| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 content::WebContentsTester::CreateTestWebContents(profile(), NULL), | 175 content::WebContentsTester::CreateTestWebContents(profile(), NULL), |
| 176 prerender::FinalStatus::FINAL_STATUS_USED); | 176 prerender::FinalStatus::FINAL_STATUS_USED); |
| 177 GURL gurl("http://testit.sea"); | 177 GURL gurl("http://testit.sea"); |
| 178 EXPECT_TRUE(loader()->IsIdle()); | 178 EXPECT_TRUE(loader()->IsIdle()); |
| 179 EXPECT_FALSE(loader()->IsLoaded()); | 179 EXPECT_FALSE(loader()->IsLoaded()); |
| 180 EXPECT_TRUE(loader()->LoadPage( | 180 EXPECT_TRUE(loader()->LoadPage( |
| 181 gurl, | 181 gurl, |
| 182 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); | 182 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); |
| 183 | 183 |
| 184 test_adapter()->GetObserver()->OnPrerenderDomContentLoaded(); | 184 test_adapter()->GetObserver()->OnPrerenderDomContentLoaded(); |
| 185 // Skip SnapshotController's wait time and emulate StartSnapshot call. |
| 186 loader()->StartSnapshot(); |
| 185 PumpLoop(); | 187 PumpLoop(); |
| 186 EXPECT_FALSE(loader()->IsIdle()); | 188 EXPECT_FALSE(loader()->IsIdle()); |
| 187 EXPECT_TRUE(loader()->IsLoaded()); | 189 EXPECT_TRUE(loader()->IsLoaded()); |
| 188 EXPECT_TRUE(callback_called()); | 190 EXPECT_TRUE(callback_called()); |
| 189 EXPECT_EQ(Offliner::RequestStatus::LOADED, callback_load_status()); | 191 EXPECT_EQ(Offliner::RequestStatus::LOADED, callback_load_status()); |
| 190 | 192 |
| 191 loader()->StopLoading(); | 193 loader()->StopLoading(); |
| 192 EXPECT_TRUE(loader()->IsIdle()); | 194 EXPECT_TRUE(loader()->IsIdle()); |
| 193 EXPECT_FALSE(loader()->IsLoaded()); | 195 EXPECT_FALSE(loader()->IsLoaded()); |
| 194 } | 196 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 test_adapter()->Disable(); | 286 test_adapter()->Disable(); |
| 285 GURL gurl("http://testit.sea"); | 287 GURL gurl("http://testit.sea"); |
| 286 EXPECT_TRUE(loader()->IsIdle()); | 288 EXPECT_TRUE(loader()->IsIdle()); |
| 287 EXPECT_FALSE(loader()->LoadPage( | 289 EXPECT_FALSE(loader()->LoadPage( |
| 288 gurl, | 290 gurl, |
| 289 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); | 291 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); |
| 290 EXPECT_TRUE(loader()->IsIdle()); | 292 EXPECT_TRUE(loader()->IsIdle()); |
| 291 } | 293 } |
| 292 | 294 |
| 293 } // namespace offline_pages | 295 } // namespace offline_pages |
| OLD | NEW |