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 <string> |
6 #include <gtest/gtest.h> | 6 #include <gtest/gtest.h> |
7 #include "update_engine/action.h" | 7 #include "update_engine/action.h" |
8 #include "update_engine/action_processor.h" | 8 #include "update_engine/action_processor.h" |
9 | 9 |
10 using std::string; | 10 using std::string; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 EXPECT_EQ(action_processor.current_action(), &action); | 54 EXPECT_EQ(action_processor.current_action(), &action); |
55 action.CompleteAction(); | 55 action.CompleteAction(); |
56 EXPECT_FALSE(action_processor.IsRunning()); | 56 EXPECT_FALSE(action_processor.IsRunning()); |
57 EXPECT_FALSE(action.IsRunning()); | 57 EXPECT_FALSE(action.IsRunning()); |
58 } | 58 } |
59 | 59 |
60 namespace { | 60 namespace { |
61 class MyActionProcessorDelegate : public ActionProcessorDelegate { | 61 class MyActionProcessorDelegate : public ActionProcessorDelegate { |
62 public: | 62 public: |
63 explicit MyActionProcessorDelegate(const ActionProcessor* processor) | 63 explicit MyActionProcessorDelegate(const ActionProcessor* processor) |
64 : processor_(processor), processing_done_called_(false) {} | 64 : processor_(processor), |
| 65 processing_done_called_(false), |
| 66 processing_stopped_called_(false), |
| 67 action_completed_called_(false), |
| 68 action_completed_success_(false) {} |
65 | 69 |
66 virtual void ProcessingDone(const ActionProcessor* processor, bool success) { | 70 virtual void ProcessingDone(const ActionProcessor* processor, bool success) { |
67 EXPECT_EQ(processor_, processor); | 71 EXPECT_EQ(processor_, processor); |
68 EXPECT_FALSE(processing_done_called_); | 72 EXPECT_FALSE(processing_done_called_); |
69 processing_done_called_ = true; | 73 processing_done_called_ = true; |
70 } | 74 } |
71 virtual void ProcessingStopped(const ActionProcessor* processor) { | 75 virtual void ProcessingStopped(const ActionProcessor* processor) { |
72 EXPECT_EQ(processor_, processor); | 76 EXPECT_EQ(processor_, processor); |
73 EXPECT_FALSE(processing_stopped_called_); | 77 EXPECT_FALSE(processing_stopped_called_); |
74 processing_stopped_called_ = true; | 78 processing_stopped_called_ = true; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 action.CompleteAction(); | 166 action.CompleteAction(); |
163 | 167 |
164 action_processor.EnqueueAction(&action); | 168 action_processor.EnqueueAction(&action); |
165 action_processor.StartProcessing(); | 169 action_processor.StartProcessing(); |
166 action_processor.StopProcessing(); | 170 action_processor.StopProcessing(); |
167 | 171 |
168 action_processor.set_delegate(NULL); | 172 action_processor.set_delegate(NULL); |
169 } | 173 } |
170 | 174 |
171 } // namespace chromeos_update_engine | 175 } // namespace chromeos_update_engine |
OLD | NEW |