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

Side by Side Diff: components/precache/content/precache_manager_unittest.cc

Issue 2037843002: Remove use of deprecated MessageLoop methods in components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change precache Created 4 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/precache/content/precache_manager.h" 5 #include "components/precache/content/precache_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 EXPECT_CALL(history_service_, TopHosts(NumTopHosts(), _)) 318 EXPECT_CALL(history_service_, TopHosts(NumTopHosts(), _))
319 .WillOnce(ReturnHosts( 319 .WillOnce(ReturnHosts(
320 history::TopHostsList(1, std::make_pair("starting-url.com", 1)))); 320 history::TopHostsList(1, std::make_pair("starting-url.com", 1))));
321 321
322 precache_manager_->StartPrecaching(precache_callback_.GetCallback()); 322 precache_manager_->StartPrecaching(precache_callback_.GetCallback());
323 323
324 EXPECT_TRUE(precache_manager_->IsPrecaching()); 324 EXPECT_TRUE(precache_manager_->IsPrecaching());
325 // Run a task to get unfinished work, and to get hosts. 325 // Run a task to get unfinished work, and to get hosts.
326 for (int i = 0; i < 2; ++i) { 326 for (int i = 0; i < 2; ++i) {
327 base::RunLoop run_loop; 327 base::RunLoop run_loop;
328 base::MessageLoop::current()->PostTask(FROM_HERE, run_loop.QuitClosure()); 328 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
329 run_loop.QuitClosure());
329 run_loop.Run(); 330 run_loop.Run();
330 } 331 }
331 // base::RunLoop().RunUntilIdle(); 332 // base::RunLoop().RunUntilIdle();
332 precache_manager_->CancelPrecaching(); 333 precache_manager_->CancelPrecaching();
333 EXPECT_FALSE(precache_manager_->IsPrecaching()); 334 EXPECT_FALSE(precache_manager_->IsPrecaching());
334 335
335 base::RunLoop().RunUntilIdle(); // For PrecacheFetcher. 336 base::RunLoop().RunUntilIdle(); // For PrecacheFetcher.
336 EXPECT_FALSE(precache_manager_->IsPrecaching()); 337 EXPECT_FALSE(precache_manager_->IsPrecaching());
337 EXPECT_FALSE(precache_callback_.was_on_done_called()); 338 EXPECT_FALSE(precache_callback_.was_on_done_called());
338 339
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 expected_histogram_count_map["Precache.Saved"] += 2; 519 expected_histogram_count_map["Precache.Saved"] += 2;
519 520
520 base::RunLoop().RunUntilIdle(); 521 base::RunLoop().RunUntilIdle();
521 EXPECT_THAT(histograms_.GetTotalCountsForPrefix("Precache."), 522 EXPECT_THAT(histograms_.GetTotalCountsForPrefix("Precache."),
522 ContainerEq(expected_histogram_count_map)); 523 ContainerEq(expected_histogram_count_map));
523 } 524 }
524 525
525 } // namespace 526 } // namespace
526 527
527 } // namespace precache 528 } // namespace precache
OLDNEW
« no previous file with comments | « components/plugins/renderer/webview_plugin.cc ('k') | components/safe_browsing_db/database_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698