| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/sync/notifier/registration_manager.h" | 5 #include "chrome/browser/sync/notifier/registration_manager.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 results[i] = MakeRegistrationUpdateResult(kModelTypes[i]); | 146 results[i] = MakeRegistrationUpdateResult(kModelTypes[i]); |
| 147 } | 147 } |
| 148 | 148 |
| 149 // Generate a variety of error conditions in all but the first | 149 // Generate a variety of error conditions in all but the first |
| 150 // result. | 150 // result. |
| 151 results[1].mutable_operation()->set_type( | 151 results[1].mutable_operation()->set_type( |
| 152 invalidation::RegistrationUpdate::UNREGISTER); | 152 invalidation::RegistrationUpdate::UNREGISTER); |
| 153 results[2].mutable_operation()->mutable_object_id()-> | 153 results[2].mutable_operation()->mutable_object_id()-> |
| 154 mutable_name()->set_string_value("garbage"); | 154 mutable_name()->set_string_value("garbage"); |
| 155 results[3].mutable_status()-> | 155 results[3].mutable_status()-> |
| 156 set_code(invalidation::Status::UNKNOWN_ERROR); | 156 set_code(invalidation::Status::PERMANENT_FAILURE); |
| 157 *results[4].mutable_operation()->mutable_object_id() = | 157 *results[4].mutable_operation()->mutable_object_id() = |
| 158 ModelTypeToObjectId(syncable::TYPED_URLS); | 158 ModelTypeToObjectId(syncable::TYPED_URLS); |
| 159 | 159 |
| 160 | 160 |
| 161 // Send the registration results back. | 161 // Send the registration results back. |
| 162 for (size_t i = 0; i < kModelTypeCount; ++i) { | 162 for (size_t i = 0; i < kModelTypeCount; ++i) { |
| 163 fake_invalidation_client_.register_calls[i].callback->Run(results[i]); | 163 fake_invalidation_client_.register_calls[i].callback->Run(results[i]); |
| 164 } | 164 } |
| 165 | 165 |
| 166 // Only the first one should be registered. | 166 // Only the first one should be registered. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 } | 278 } |
| 279 | 279 |
| 280 // All should be registered. | 280 // All should be registered. |
| 281 for (size_t i = 0; i < kModelTypeCount; ++i) { | 281 for (size_t i = 0; i < kModelTypeCount; ++i) { |
| 282 EXPECT_TRUE(registration_manager_.IsRegistered(kModelTypes[i])); | 282 EXPECT_TRUE(registration_manager_.IsRegistered(kModelTypes[i])); |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 | 285 |
| 286 } // namespace | 286 } // namespace |
| 287 } // namespace notifier | 287 } // namespace notifier |
| OLD | NEW |