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

Side by Side Diff: chromeos/dbus/fake_update_engine_client.cc

Issue 2081873002: Incorporate comments in Dbus code and add Eol icon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wrap the include with #if defined(OS_CHROMEOS). 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 | « chromeos/dbus/fake_update_engine_client.h ('k') | chromeos/dbus/update_engine_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chromeos/dbus/fake_update_engine_client.h" 5 #include "chromeos/dbus/fake_update_engine_client.h"
6 6
7 #include "base/bind.h"
8 #include "base/threading/thread_task_runner_handle.h"
9
7 namespace chromeos { 10 namespace chromeos {
8 11
9 FakeUpdateEngineClient::FakeUpdateEngineClient() 12 FakeUpdateEngineClient::FakeUpdateEngineClient()
10 : update_check_result_(UpdateEngineClient::UPDATE_RESULT_SUCCESS), 13 : update_check_result_(UpdateEngineClient::UPDATE_RESULT_SUCCESS),
11 can_rollback_stub_result_(false), 14 can_rollback_stub_result_(false),
12 reboot_after_update_call_count_(0), 15 reboot_after_update_call_count_(0),
13 request_update_check_call_count_(0), 16 request_update_check_call_count_(0),
14 rollback_call_count_(0), 17 rollback_call_count_(0),
15 can_rollback_call_count_(0) { 18 can_rollback_call_count_(0),
16 } 19 weak_ptr_factory_(this) {}
17 20
18 FakeUpdateEngineClient::~FakeUpdateEngineClient() { 21 FakeUpdateEngineClient::~FakeUpdateEngineClient() {
19 } 22 }
20 23
21 void FakeUpdateEngineClient::Init(dbus::Bus* bus) { 24 void FakeUpdateEngineClient::Init(dbus::Bus* bus) {
22 } 25 }
23 26
24 void FakeUpdateEngineClient::AddObserver(Observer* observer) { 27 void FakeUpdateEngineClient::AddObserver(Observer* observer) {
25 observers_.AddObserver(observer); 28 observers_.AddObserver(observer);
26 } 29 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 const UpdateEngineClient::Status& status) { 69 const UpdateEngineClient::Status& status) {
67 FOR_EACH_OBSERVER(Observer, observers_, UpdateStatusChanged(status)); 70 FOR_EACH_OBSERVER(Observer, observers_, UpdateStatusChanged(status));
68 } 71 }
69 72
70 void FakeUpdateEngineClient::SetChannel(const std::string& target_channel, 73 void FakeUpdateEngineClient::SetChannel(const std::string& target_channel,
71 bool is_powerwash_allowed) { 74 bool is_powerwash_allowed) {
72 } 75 }
73 76
74 void FakeUpdateEngineClient::GetChannel(bool get_current_channel, 77 void FakeUpdateEngineClient::GetChannel(bool get_current_channel,
75 const GetChannelCallback& callback) { 78 const GetChannelCallback& callback) {
79 base::ThreadTaskRunnerHandle::Get()->PostTask(
80 FROM_HERE, base::Bind(&FakeUpdateEngineClient::OnGetChannel,
81 weak_ptr_factory_.GetWeakPtr(), callback));
76 } 82 }
77 83
78 void FakeUpdateEngineClient::GetEolStatus( 84 void FakeUpdateEngineClient::GetEolStatus(
79 const GetEolStatusCallback& callback) {} 85 const GetEolStatusCallback& callback) {
86 base::ThreadTaskRunnerHandle::Get()->PostTask(
87 FROM_HERE, base::Bind(&FakeUpdateEngineClient::OnGetEolStatus,
88 weak_ptr_factory_.GetWeakPtr(), callback));
89 }
80 90
81 void FakeUpdateEngineClient::set_default_status( 91 void FakeUpdateEngineClient::set_default_status(
82 const UpdateEngineClient::Status& status) { 92 const UpdateEngineClient::Status& status) {
83 default_status_ = status; 93 default_status_ = status;
84 } 94 }
85 95
86 void FakeUpdateEngineClient::set_update_check_result( 96 void FakeUpdateEngineClient::set_update_check_result(
87 const UpdateEngineClient::UpdateCheckResult& result) { 97 const UpdateEngineClient::UpdateCheckResult& result) {
88 update_check_result_ = result; 98 update_check_result_ = result;
89 } 99 }
90 100
101 void FakeUpdateEngineClient::OnGetChannel(const GetChannelCallback& callback) {
hashimoto 2016/06/23 05:12:48 You don't need these methods and weak_ptr_factory_
102 callback.Run("");
103 }
104
105 void FakeUpdateEngineClient::OnGetEolStatus(
106 const GetEolStatusCallback& callback) {
107 callback.Run(update_engine::EndOfLifeStatus::kSupported);
108 }
109
91 } // namespace chromeos 110 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_update_engine_client.h ('k') | chromeos/dbus/update_engine_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698