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

Side by Side Diff: components/dom_distiller/core/fake_distiller.cc

Issue 1144153004: components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 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/dom_distiller/core/fake_distiller.h" 5 #include "components/dom_distiller/core/fake_distiller.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/location.h"
11 #include "base/single_thread_task_runner.h"
12 #include "base/thread_task_runner_handle.h"
11 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
12 14
13 namespace dom_distiller { 15 namespace dom_distiller {
14 namespace test { 16 namespace test {
15 17
16 MockDistillerFactory::MockDistillerFactory() {} 18 MockDistillerFactory::MockDistillerFactory() {}
17 MockDistillerFactory::~MockDistillerFactory() {} 19 MockDistillerFactory::~MockDistillerFactory() {}
18 20
19 FakeDistiller::FakeDistiller(bool execute_callback) 21 FakeDistiller::FakeDistiller(bool execute_callback)
20 : execute_callback_(execute_callback), 22 : execute_callback_(execute_callback),
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 65 }
64 66
65 void FakeDistiller::RunDistillerUpdateCallback( 67 void FakeDistiller::RunDistillerUpdateCallback(
66 const ArticleDistillationUpdate& update) { 68 const ArticleDistillationUpdate& update) {
67 page_callback_.Run(update); 69 page_callback_.Run(update);
68 } 70 }
69 71
70 72
71 void FakeDistiller::PostDistillerCallback( 73 void FakeDistiller::PostDistillerCallback(
72 scoped_ptr<DistilledArticleProto> proto) { 74 scoped_ptr<DistilledArticleProto> proto) {
73 base::MessageLoop::current()->PostTask( 75 base::ThreadTaskRunnerHandle::Get()->PostTask(
74 FROM_HERE, 76 FROM_HERE, base::Bind(&FakeDistiller::RunDistillerCallbackInternal,
75 base::Bind(&FakeDistiller::RunDistillerCallbackInternal, 77 base::Unretained(this), base::Passed(&proto)));
76 base::Unretained(this),
77 base::Passed(&proto)));
78 } 78 }
79 79
80 void FakeDistiller::RunDistillerCallbackInternal( 80 void FakeDistiller::RunDistillerCallbackInternal(
81 scoped_ptr<DistilledArticleProto> proto) { 81 scoped_ptr<DistilledArticleProto> proto) {
82 EXPECT_FALSE(article_callback_.is_null()); 82 EXPECT_FALSE(article_callback_.is_null());
83 83
84 base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_, 84 base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_,
85 false); 85 false);
86 article_callback_.Run(proto.Pass()); 86 article_callback_.Run(proto.Pass());
87 article_callback_.Reset(); 87 article_callback_.Reset();
88 } 88 }
89 89
90 } // namespace test 90 } // namespace test
91 } // namespace dom_distiller 91 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « components/dom_distiller/core/dom_distiller_store.cc ('k') | components/dom_distiller/core/task_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698