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

Side by Side Diff: test_utils.h

Issue 3022008: For actions, switch bool success into an exit code. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: switch to all positive error codes. Created 10 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « set_bootable_flag_action.cc ('k') | update_attempter.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) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_TEST_UTILS_H__ 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_TEST_UTILS_H__
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_TEST_UTILS_H__ 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_TEST_UTILS_H__
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 #include <gtest/gtest.h> 11 #include <gtest/gtest.h>
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 struct ObjectFeederAction : public Action<ObjectFeederAction<T> > { 155 struct ObjectFeederAction : public Action<ObjectFeederAction<T> > {
156 public: 156 public:
157 typedef NoneType InputObjectType; 157 typedef NoneType InputObjectType;
158 typedef T OutputObjectType; 158 typedef T OutputObjectType;
159 void PerformAction() { 159 void PerformAction() {
160 LOG(INFO) << "feeder running!"; 160 LOG(INFO) << "feeder running!";
161 CHECK(this->processor_); 161 CHECK(this->processor_);
162 if (this->HasOutputPipe()) { 162 if (this->HasOutputPipe()) {
163 this->SetOutputObject(out_obj_); 163 this->SetOutputObject(out_obj_);
164 } 164 }
165 this->processor_->ActionComplete(this, true); 165 this->processor_->ActionComplete(this, kActionCodeSuccess);
166 } 166 }
167 static std::string StaticType() { return "ObjectFeederAction"; } 167 static std::string StaticType() { return "ObjectFeederAction"; }
168 std::string Type() const { return StaticType(); } 168 std::string Type() const { return StaticType(); }
169 void set_obj(const T& out_obj) { 169 void set_obj(const T& out_obj) {
170 out_obj_ = out_obj; 170 out_obj_ = out_obj;
171 } 171 }
172 private: 172 private:
173 T out_obj_; 173 T out_obj_;
174 }; 174 };
175 175
(...skipping 13 matching lines...) Expand all
189 struct ObjectCollectorAction : public Action<ObjectCollectorAction<T> > { 189 struct ObjectCollectorAction : public Action<ObjectCollectorAction<T> > {
190 public: 190 public:
191 typedef T InputObjectType; 191 typedef T InputObjectType;
192 typedef NoneType OutputObjectType; 192 typedef NoneType OutputObjectType;
193 void PerformAction() { 193 void PerformAction() {
194 LOG(INFO) << "collector running!"; 194 LOG(INFO) << "collector running!";
195 ASSERT_TRUE(this->processor_); 195 ASSERT_TRUE(this->processor_);
196 if (this->HasInputObject()) { 196 if (this->HasInputObject()) {
197 object_ = this->GetInputObject(); 197 object_ = this->GetInputObject();
198 } 198 }
199 this->processor_->ActionComplete(this, true); 199 this->processor_->ActionComplete(this, kActionCodeSuccess);
200 } 200 }
201 static std::string StaticType() { return "ObjectCollectorAction"; } 201 static std::string StaticType() { return "ObjectCollectorAction"; }
202 std::string Type() const { return StaticType(); } 202 std::string Type() const { return StaticType(); }
203 const T& object() const { return object_; } 203 const T& object() const { return object_; }
204 private: 204 private:
205 T object_; 205 T object_;
206 }; 206 };
207 207
208 } // namespace chromeos_update_engine 208 } // namespace chromeos_update_engine
209 209
210 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_TEST_UTILS_H__ 210 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_TEST_UTILS_H__
OLDNEW
« no previous file with comments | « set_bootable_flag_action.cc ('k') | update_attempter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698