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

Side by Side Diff: chrome/browser/extensions/test_blacklist.cc

Issue 1112573002: [chrome/browser/extensions] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolving ng browser unittest issues Created 5 years, 7 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/extensions/test_blacklist.h" 5 #include "chrome/browser/extensions/test_blacklist.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h" 10 #include "base/run_loop.h"
12 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/thread_task_runner_handle.h"
13 #include "chrome/browser/extensions/blacklist.h" 13 #include "chrome/browser/extensions/blacklist.h"
14 #include "chrome/browser/extensions/blacklist_state_fetcher.h" 14 #include "chrome/browser/extensions/blacklist_state_fetcher.h"
15 #include "chrome/browser/extensions/fake_safe_browsing_database_manager.h" 15 #include "chrome/browser/extensions/fake_safe_browsing_database_manager.h"
16 16
17 namespace extensions { 17 namespace extensions {
18 18
19 namespace { 19 namespace {
20 20
21 void Assign(BlacklistState *out, BlacklistState in) { 21 void Assign(BlacklistState *out, BlacklistState in) {
22 *out = in; 22 *out = in;
23 } 23 }
24 24
25 } // namespace 25 } // namespace
26 26
27 BlacklistStateFetcherMock::BlacklistStateFetcherMock() : request_count_(0) {} 27 BlacklistStateFetcherMock::BlacklistStateFetcherMock() : request_count_(0) {}
28 28
29 BlacklistStateFetcherMock::~BlacklistStateFetcherMock() {} 29 BlacklistStateFetcherMock::~BlacklistStateFetcherMock() {}
30 30
31 void BlacklistStateFetcherMock::Request(const std::string& id, 31 void BlacklistStateFetcherMock::Request(const std::string& id,
32 const RequestCallback& callback) { 32 const RequestCallback& callback) {
33 ++request_count_; 33 ++request_count_;
34 34
35 BlacklistState result = NOT_BLACKLISTED; 35 BlacklistState result = NOT_BLACKLISTED;
36 if (ContainsKey(states_, id)) 36 if (ContainsKey(states_, id))
37 result = states_[id]; 37 result = states_[id];
38 38
39 base::MessageLoopProxy::current()->PostTask(FROM_HERE, 39 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
40 base::Bind(callback, result)); 40 base::Bind(callback, result));
41 } 41 }
42 42
43 void BlacklistStateFetcherMock::SetState(const std::string& id, 43 void BlacklistStateFetcherMock::SetState(const std::string& id,
44 BlacklistState state) { 44 BlacklistState state) {
45 states_[id] = state; 45 states_[id] = state;
46 } 46 }
47 47
48 void BlacklistStateFetcherMock::Clear() { 48 void BlacklistStateFetcherMock::Clear() {
49 states_.clear(); 49 states_.clear();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 void TestBlacklist::EnableSafeBrowsing() { 127 void TestBlacklist::EnableSafeBrowsing() {
128 blacklist_db_->Enable(); 128 blacklist_db_->Enable();
129 } 129 }
130 130
131 void TestBlacklist::NotifyUpdate() { 131 void TestBlacklist::NotifyUpdate() {
132 blacklist_db_->NotifyUpdate(); 132 blacklist_db_->NotifyUpdate();
133 } 133 }
134 134
135 } // namespace extensions 135 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/startup_helper.cc ('k') | chrome/browser/extensions/test_blacklist_state_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698