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

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

Issue 2405863003: [Offline Pages] Fix PrerenderingLoader regression for handle a stop event from the prerender stack. (Closed)
Patch Set: Created 4 years, 2 months 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 | « chrome/browser/android/offline_pages/prerendering_loader.cc ('k') | no next file » | 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 EXPECT_TRUE(callback_called()); 229 EXPECT_TRUE(callback_called());
230 EXPECT_EQ(Offliner::RequestStatus::LOADED, callback_load_status()); 230 EXPECT_EQ(Offliner::RequestStatus::LOADED, callback_load_status());
231 231
232 // Consider Prerenderer stops (eg, times out) before Loader is done with it. 232 // Consider Prerenderer stops (eg, times out) before Loader is done with it.
233 test_adapter()->GetObserver()->OnPrerenderStop(); 233 test_adapter()->GetObserver()->OnPrerenderStop();
234 PumpLoop(); 234 PumpLoop();
235 EXPECT_TRUE(loader()->IsIdle()); 235 EXPECT_TRUE(loader()->IsIdle());
236 EXPECT_FALSE(loader()->IsLoaded()); 236 EXPECT_FALSE(loader()->IsLoaded());
237 EXPECT_EQ(Offliner::RequestStatus::PRERENDERING_CANCELED, 237 EXPECT_EQ(Offliner::RequestStatus::PRERENDERING_CANCELED,
238 callback_load_status()); 238 callback_load_status());
239 EXPECT_FALSE(test_adapter()->IsActive());
239 } 240 }
240 241
241 TEST_F(PrerenderingLoaderTest, LoadPageLoadFailedNoContent) { 242 TEST_F(PrerenderingLoaderTest, LoadPageLoadFailedNoContent) {
242 test_adapter()->Configure(nullptr /* web_contents */, 243 test_adapter()->Configure(nullptr /* web_contents */,
243 prerender::FINAL_STATUS_MEMORY_LIMIT_EXCEEDED); 244 prerender::FINAL_STATUS_MEMORY_LIMIT_EXCEEDED);
244 GURL gurl("http://testit.sea"); 245 GURL gurl("http://testit.sea");
245 EXPECT_TRUE(loader()->IsIdle()); 246 EXPECT_TRUE(loader()->IsIdle());
246 EXPECT_TRUE(loader()->LoadPage( 247 EXPECT_TRUE(loader()->LoadPage(
247 gurl, 248 gurl,
248 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); 249 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this))));
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 test_adapter()->FailStart(); 381 test_adapter()->FailStart();
381 GURL gurl("http://testit.sea"); 382 GURL gurl("http://testit.sea");
382 EXPECT_TRUE(loader()->IsIdle()); 383 EXPECT_TRUE(loader()->IsIdle());
383 EXPECT_FALSE(loader()->LoadPage( 384 EXPECT_FALSE(loader()->LoadPage(
384 gurl, 385 gurl,
385 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); 386 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this))));
386 EXPECT_TRUE(loader()->IsIdle()); 387 EXPECT_TRUE(loader()->IsIdle());
387 } 388 }
388 389
389 } // namespace offline_pages 390 } // namespace offline_pages
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/prerendering_loader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698