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

Side by Side Diff: chrome/browser/android/offline_pages/prerendering_loader_unittest.cc

Issue 2380093002: [Offline Pages] SnapshotController support for delay after onLoadCompleted and also parameterized c… (Closed)
Patch Set: Fixed a comment Created 4 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/recent_tab_helper_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 EXPECT_FALSE(loader()->IsLoaded()); 216 EXPECT_FALSE(loader()->IsLoaded());
217 EXPECT_TRUE(loader()->LoadPage( 217 EXPECT_TRUE(loader()->LoadPage(
218 gurl, 218 gurl,
219 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); 219 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this))));
220 220
221 PumpLoop(); 221 PumpLoop();
222 EXPECT_FALSE(loader()->IsIdle()); 222 EXPECT_FALSE(loader()->IsIdle());
223 EXPECT_FALSE(loader()->IsLoaded()); 223 EXPECT_FALSE(loader()->IsLoaded());
224 224
225 test_adapter()->GetObserver()->OnPrerenderStopLoading(); 225 test_adapter()->GetObserver()->OnPrerenderStopLoading();
226 // Skip SnapshotController's wait time and emulate StartSnapshot call.
227 loader()->StartSnapshot();
226 PumpLoop(); 228 PumpLoop();
227 EXPECT_FALSE(loader()->IsIdle()); 229 EXPECT_FALSE(loader()->IsIdle());
228 EXPECT_TRUE(loader()->IsLoaded()); 230 EXPECT_TRUE(loader()->IsLoaded());
229 EXPECT_TRUE(callback_called()); 231 EXPECT_TRUE(callback_called());
230 EXPECT_EQ(Offliner::RequestStatus::LOADED, callback_load_status()); 232 EXPECT_EQ(Offliner::RequestStatus::LOADED, callback_load_status());
231 233
232 // Consider Prerenderer stops (eg, times out) before Loader is done with it. 234 // Consider Prerenderer stops (eg, times out) before Loader is done with it.
233 test_adapter()->GetObserver()->OnPrerenderStop(); 235 test_adapter()->GetObserver()->OnPrerenderStop();
234 PumpLoop(); 236 PumpLoop();
235 EXPECT_TRUE(loader()->IsIdle()); 237 EXPECT_TRUE(loader()->IsIdle());
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 test_adapter()->FailStart(); 383 test_adapter()->FailStart();
382 GURL gurl("http://testit.sea"); 384 GURL gurl("http://testit.sea");
383 EXPECT_TRUE(loader()->IsIdle()); 385 EXPECT_TRUE(loader()->IsIdle());
384 EXPECT_FALSE(loader()->LoadPage( 386 EXPECT_FALSE(loader()->LoadPage(
385 gurl, 387 gurl,
386 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); 388 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this))));
387 EXPECT_TRUE(loader()->IsIdle()); 389 EXPECT_TRUE(loader()->IsIdle());
388 } 390 }
389 391
390 } // namespace offline_pages 392 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/recent_tab_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698