OLD | NEW |
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 "testing/gmock/include/gmock/gmock.h" | 5 #include "testing/gmock/include/gmock/gmock.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 #include "chrome/browser/sync/glue/fake_data_type_controller.h" | 8 #include "chrome/browser/sync/glue/fake_data_type_controller.h" |
9 | 9 |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 state_ = NOT_RUNNING; | 67 state_ = NOT_RUNNING; |
68 error.Reset(FROM_HERE, "Fake error", type_); | 68 error.Reset(FROM_HERE, "Fake error", type_); |
69 } | 69 } |
70 last_start_callback_.Run(result, error); | 70 last_start_callback_.Run(result, error); |
71 last_start_callback_.Reset(); | 71 last_start_callback_.Reset(); |
72 } | 72 } |
73 | 73 |
74 // * -> NOT_RUNNING | 74 // * -> NOT_RUNNING |
75 void FakeDataTypeController::Stop() { | 75 void FakeDataTypeController::Stop() { |
76 state_ = NOT_RUNNING; | 76 state_ = NOT_RUNNING; |
77 if (!model_load_callback_.is_null()) { | |
78 // Real data type controllers run the callback and specify "ABORTED" as an | |
79 // error. We should probably find a way to use the real code and mock out | |
80 // unnecessary pieces. | |
81 SimulateModelLoadFinishing(); | |
82 } | |
83 | |
84 // The DTM still expects |last_start_callback_| to be called back. | 77 // The DTM still expects |last_start_callback_| to be called back. |
85 if (!last_start_callback_.is_null()) { | 78 if (!last_start_callback_.is_null()) { |
86 SyncError error(FROM_HERE, "Fake error", type_); | 79 SyncError error(FROM_HERE, "Fake error", type_); |
87 last_start_callback_.Run(ABORTED, error); | 80 last_start_callback_.Run(ABORTED, error); |
88 } | 81 } |
89 } | 82 } |
90 | 83 |
91 ModelType FakeDataTypeController::type() const { | 84 ModelType FakeDataTypeController::type() const { |
92 return type_; | 85 return type_; |
93 } | 86 } |
(...skipping 27 matching lines...) Expand all Loading... |
121 void FakeDataTypeController::SetDelayModelLoad() { | 114 void FakeDataTypeController::SetDelayModelLoad() { |
122 model_load_delayed_ = true; | 115 model_load_delayed_ = true; |
123 } | 116 } |
124 | 117 |
125 void FakeDataTypeController::SimulateModelLoadFinishing() { | 118 void FakeDataTypeController::SimulateModelLoadFinishing() { |
126 ModelLoadCallback model_load_callback = model_load_callback_; | 119 ModelLoadCallback model_load_callback = model_load_callback_; |
127 model_load_callback.Run(type(), SyncError()); | 120 model_load_callback.Run(type(), SyncError()); |
128 } | 121 } |
129 | 122 |
130 } // namespace browser_sync | 123 } // namespace browser_sync |
OLD | NEW |