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

Side by Side Diff: chrome/browser/sync/backend_migrator_unittest.cc

Issue 7621085: Server directed error handling backend code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. Created 9 years, 3 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/backend_migrator.h" 5 #include "chrome/browser/sync/backend_migrator.h"
6 6
7 #include "chrome/browser/sync/sessions/sync_protocol_error.h"
7 #include "chrome/browser/sync/glue/data_type_manager_mock.h" 8 #include "chrome/browser/sync/glue/data_type_manager_mock.h"
8 #include "chrome/browser/sync/profile_sync_service_mock.h" 9 #include "chrome/browser/sync/profile_sync_service_mock.h"
9 #include "chrome/browser/sync/sessions/session_state.h" 10 #include "chrome/browser/sync/sessions/session_state.h"
10 #include "chrome/common/chrome_notification_types.h" 11 #include "chrome/common/chrome_notification_types.h"
11 #include "chrome/test/base/testing_browser_process_test.h" 12 #include "chrome/test/base/testing_browser_process_test.h"
12 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 using ::testing::_; 16 using ::testing::_;
16 using ::testing::Eq; 17 using ::testing::Eq;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 const syncable::ModelTypeSet& for_types) { 50 const syncable::ModelTypeSet& for_types) {
50 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; 51 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT];
51 for (syncable::ModelTypeSet::const_iterator it = for_types.begin(); 52 for (syncable::ModelTypeSet::const_iterator it = for_types.begin();
52 it != for_types.end(); ++it) { 53 it != for_types.end(); ++it) {
53 download_progress_markers[*it] = "foobar"; 54 download_progress_markers[*it] = "foobar";
54 } 55 }
55 56
56 snap_.reset(new SyncSessionSnapshot(SyncerStatus(), ErrorCounters(), 57 snap_.reset(new SyncSessionSnapshot(SyncerStatus(), ErrorCounters(),
57 0, false, syncable::ModelTypeBitSet(), download_progress_markers, 58 0, false, syncable::ModelTypeBitSet(), download_progress_markers,
58 false, false, 0, 0, 0, false, sessions::SyncSourceInfo(), 0, 59 false, false, 0, 0, 0, false, sessions::SyncSourceInfo(), 0,
59 base::Time::Now())); 60 base::Time::Now(), browser_sync::sessions::SyncProtocolError()));
60 EXPECT_CALL(service_, GetLastSessionSnapshot()) 61 EXPECT_CALL(service_, GetLastSessionSnapshot())
61 .WillOnce(Return(snap_.get())); 62 .WillOnce(Return(snap_.get()));
62 } 63 }
63 64
64 void SendConfigureDone(DataTypeManager::ConfigureStatus status, 65 void SendConfigureDone(DataTypeManager::ConfigureStatus status,
65 const syncable::ModelTypeSet& types) { 66 const syncable::ModelTypeSet& types) {
66 if (status == DataTypeManager::OK) { 67 if (status == DataTypeManager::OK) {
67 DataTypeManager::ConfigureResult result(status, types); 68 DataTypeManager::ConfigureResult result(status, types);
68 NotificationService::current()->Notify( 69 NotificationService::current()->Notify(
69 chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, 70 chrome::NOTIFICATION_SYNC_CONFIGURE_DONE,
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 EXPECT_CALL(*manager(), state()) 312 EXPECT_CALL(*manager(), state())
312 .WillOnce(Return(DataTypeManager::CONFIGURED)); 313 .WillOnce(Return(DataTypeManager::CONFIGURED));
313 EXPECT_CALL(*manager(), Configure(_, sync_api::CONFIGURE_REASON_MIGRATION)) 314 EXPECT_CALL(*manager(), Configure(_, sync_api::CONFIGURE_REASON_MIGRATION))
314 .Times(1); 315 .Times(1);
315 migrator.MigrateTypes(to_migrate); 316 migrator.MigrateTypes(to_migrate);
316 SendConfigureDone(DataTypeManager::ABORTED, syncable::ModelTypeSet()); 317 SendConfigureDone(DataTypeManager::ABORTED, syncable::ModelTypeSet());
317 EXPECT_EQ(BackendMigrator::IDLE, migrator.state()); 318 EXPECT_EQ(BackendMigrator::IDLE, migrator.state());
318 } 319 }
319 320
320 }; // namespace browser_sync 321 }; // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/engine/sync_scheduler.h » ('j') | chrome/browser/sync/engine/sync_scheduler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698