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

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

Issue 2357013002: Fix an issue that PrerenderLoader::OnPrerenderStart() never gets called. (Closed)
Patch Set: nits Created 4 years, 3 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 test_adapter()->Configure( 211 test_adapter()->Configure(
212 content::WebContentsTester::CreateTestWebContents(profile(), NULL), 212 content::WebContentsTester::CreateTestWebContents(profile(), NULL),
213 prerender::FinalStatus::FINAL_STATUS_USED); 213 prerender::FinalStatus::FINAL_STATUS_USED);
214 GURL gurl("http://testit.sea"); 214 GURL gurl("http://testit.sea");
215 EXPECT_TRUE(loader()->IsIdle()); 215 EXPECT_TRUE(loader()->IsIdle());
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 test_adapter()->GetObserver()->OnPrerenderStart();
222 PumpLoop(); 221 PumpLoop();
223 EXPECT_FALSE(loader()->IsIdle()); 222 EXPECT_FALSE(loader()->IsIdle());
224 EXPECT_FALSE(loader()->IsLoaded()); 223 EXPECT_FALSE(loader()->IsLoaded());
225 224
226 test_adapter()->GetObserver()->OnPrerenderStopLoading(); 225 test_adapter()->GetObserver()->OnPrerenderStopLoading();
227 PumpLoop(); 226 PumpLoop();
228 EXPECT_FALSE(loader()->IsIdle()); 227 EXPECT_FALSE(loader()->IsIdle());
229 EXPECT_TRUE(loader()->IsLoaded()); 228 EXPECT_TRUE(loader()->IsLoaded());
230 EXPECT_TRUE(callback_called()); 229 EXPECT_TRUE(callback_called());
231 EXPECT_EQ(Offliner::RequestStatus::LOADED, callback_load_status()); 230 EXPECT_EQ(Offliner::RequestStatus::LOADED, callback_load_status());
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 test_adapter()->FailStart(); 334 test_adapter()->FailStart();
336 GURL gurl("http://testit.sea"); 335 GURL gurl("http://testit.sea");
337 EXPECT_TRUE(loader()->IsIdle()); 336 EXPECT_TRUE(loader()->IsIdle());
338 EXPECT_FALSE(loader()->LoadPage( 337 EXPECT_FALSE(loader()->LoadPage(
339 gurl, 338 gurl,
340 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); 339 base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this))));
341 EXPECT_TRUE(loader()->IsIdle()); 340 EXPECT_TRUE(loader()->IsIdle());
342 } 341 }
343 342
344 } // namespace offline_pages 343 } // 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