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

Side by Side Diff: remoting/test/fake_network_manager.cc

Issue 2031083002: Remove use of deprecated MessageLoop methods in remoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « remoting/protocol/pseudotcp_adapter_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "remoting/test/fake_network_manager.h" 5 #include "remoting/test/fake_network_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/threading/thread_task_runner_handle.h"
10 #include "jingle/glue/utils.h" 12 #include "jingle/glue/utils.h"
11 #include "third_party/webrtc/base/socketaddress.h" 13 #include "third_party/webrtc/base/socketaddress.h"
12 14
13 namespace remoting { 15 namespace remoting {
14 16
15 FakeNetworkManager::FakeNetworkManager(const rtc::IPAddress& address) 17 FakeNetworkManager::FakeNetworkManager(const rtc::IPAddress& address)
16 : started_(false), 18 : started_(false),
17 weak_factory_(this) { 19 weak_factory_(this) {
18 network_.reset(new rtc::Network("fake", "Fake Network", address, 32)); 20 network_.reset(new rtc::Network("fake", "Fake Network", address, 32));
19 network_->AddIP(address); 21 network_->AddIP(address);
20 } 22 }
21 23
22 FakeNetworkManager::~FakeNetworkManager() { 24 FakeNetworkManager::~FakeNetworkManager() {
23 } 25 }
24 26
25 void FakeNetworkManager::StartUpdating() { 27 void FakeNetworkManager::StartUpdating() {
26 started_ = true; 28 started_ = true;
27 base::MessageLoop::current()->PostTask( 29 base::ThreadTaskRunnerHandle::Get()->PostTask(
28 FROM_HERE, 30 FROM_HERE, base::Bind(&FakeNetworkManager::SendNetworksChangedSignal,
29 base::Bind(&FakeNetworkManager::SendNetworksChangedSignal, 31 weak_factory_.GetWeakPtr()));
30 weak_factory_.GetWeakPtr()));
31 } 32 }
32 33
33 void FakeNetworkManager::StopUpdating() { 34 void FakeNetworkManager::StopUpdating() {
34 started_ = false; 35 started_ = false;
35 } 36 }
36 37
37 void FakeNetworkManager::GetNetworks(NetworkList* networks) const { 38 void FakeNetworkManager::GetNetworks(NetworkList* networks) const {
38 networks->clear(); 39 networks->clear();
39 networks->push_back(network_.get()); 40 networks->push_back(network_.get());
40 } 41 }
41 42
42 void FakeNetworkManager::SendNetworksChangedSignal() { 43 void FakeNetworkManager::SendNetworksChangedSignal() {
43 SignalNetworksChanged(); 44 SignalNetworksChanged();
44 } 45 }
45 46
46 } // namespace remoting 47 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/pseudotcp_adapter_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698