OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include <string> |
5 #include <gtest/gtest.h> | 6 #include <gtest/gtest.h> |
6 #include "update_engine/action.h" | 7 #include "update_engine/action.h" |
7 #include "update_engine/action_processor.h" | 8 #include "update_engine/action_processor.h" |
8 | 9 |
| 10 using std::string; |
| 11 |
9 namespace chromeos_update_engine { | 12 namespace chromeos_update_engine { |
10 | 13 |
11 using chromeos_update_engine::ActionPipe; | 14 using chromeos_update_engine::ActionPipe; |
12 | 15 |
13 class ActionProcessorTestAction; | 16 class ActionProcessorTestAction; |
14 | 17 |
15 template<> | 18 template<> |
16 class ActionTraits<ActionProcessorTestAction> { | 19 class ActionTraits<ActionProcessorTestAction> { |
17 public: | 20 public: |
18 typedef string OutputObjectType; | 21 typedef string OutputObjectType; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 EXPECT_FALSE(action_processor.IsRunning()); | 56 EXPECT_FALSE(action_processor.IsRunning()); |
54 EXPECT_FALSE(action.IsRunning()); | 57 EXPECT_FALSE(action.IsRunning()); |
55 } | 58 } |
56 | 59 |
57 namespace { | 60 namespace { |
58 class MyActionProcessorDelegate : public ActionProcessorDelegate { | 61 class MyActionProcessorDelegate : public ActionProcessorDelegate { |
59 public: | 62 public: |
60 explicit MyActionProcessorDelegate(const ActionProcessor* processor) | 63 explicit MyActionProcessorDelegate(const ActionProcessor* processor) |
61 : processor_(processor), processing_done_called_(false) {} | 64 : processor_(processor), processing_done_called_(false) {} |
62 | 65 |
63 virtual void ProcessingDone(const ActionProcessor* processor) { | 66 virtual void ProcessingDone(const ActionProcessor* processor, bool success) { |
64 EXPECT_EQ(processor_, processor); | 67 EXPECT_EQ(processor_, processor); |
65 EXPECT_FALSE(processing_done_called_); | 68 EXPECT_FALSE(processing_done_called_); |
66 processing_done_called_ = true; | 69 processing_done_called_ = true; |
67 } | 70 } |
68 virtual void ProcessingStopped(const ActionProcessor* processor) { | 71 virtual void ProcessingStopped(const ActionProcessor* processor) { |
69 EXPECT_EQ(processor_, processor); | 72 EXPECT_EQ(processor_, processor); |
70 EXPECT_FALSE(processing_stopped_called_); | 73 EXPECT_FALSE(processing_stopped_called_); |
71 processing_stopped_called_ = true; | 74 processing_stopped_called_ = true; |
72 } | 75 } |
73 virtual void ActionCompleted(ActionProcessor* processor, | 76 virtual void ActionCompleted(ActionProcessor* processor, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 action.CompleteAction(); | 162 action.CompleteAction(); |
160 | 163 |
161 action_processor.EnqueueAction(&action); | 164 action_processor.EnqueueAction(&action); |
162 action_processor.StartProcessing(); | 165 action_processor.StartProcessing(); |
163 action_processor.StopProcessing(); | 166 action_processor.StopProcessing(); |
164 | 167 |
165 action_processor.set_delegate(NULL); | 168 action_processor.set_delegate(NULL); |
166 } | 169 } |
167 | 170 |
168 } // namespace chromeos_update_engine | 171 } // namespace chromeos_update_engine |
OLD | NEW |