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

Side by Side Diff: chrome/browser/sync/test/integration/sync_test.cc

Issue 238273008: Add an action for server to send down rollback command. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
« no previous file with comments | « no previous file | sync/engine/syncer_proto_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/sync/test/integration/sync_test.h" 5 #include "chrome/browser/sync/test/integration/sync_test.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 case syncer::THROTTLED: 908 case syncer::THROTTLED:
909 return sync_pb::SyncEnums::THROTTLED; 909 return sync_pb::SyncEnums::THROTTLED;
910 case syncer::CLEAR_PENDING: 910 case syncer::CLEAR_PENDING:
911 return sync_pb::SyncEnums::CLEAR_PENDING; 911 return sync_pb::SyncEnums::CLEAR_PENDING;
912 case syncer::TRANSIENT_ERROR: 912 case syncer::TRANSIENT_ERROR:
913 return sync_pb::SyncEnums::TRANSIENT_ERROR; 913 return sync_pb::SyncEnums::TRANSIENT_ERROR;
914 case syncer::MIGRATION_DONE: 914 case syncer::MIGRATION_DONE:
915 return sync_pb::SyncEnums::MIGRATION_DONE; 915 return sync_pb::SyncEnums::MIGRATION_DONE;
916 case syncer::UNKNOWN_ERROR: 916 case syncer::UNKNOWN_ERROR:
917 return sync_pb::SyncEnums::UNKNOWN; 917 return sync_pb::SyncEnums::UNKNOWN;
918 default: 918 case syncer::INVALID_CREDENTIAL:
919 NOTREACHED(); 919 NOTREACHED(); // NOTREACHED() because auth error is not set through
920 // error code in sync response.
921 return sync_pb::SyncEnums::UNKNOWN;
922 case syncer::DISABLED_BY_ADMIN:
923 return sync_pb::SyncEnums::DISABLED_BY_ADMIN;
924 case syncer::USER_ROLLBACK:
925 return sync_pb::SyncEnums::USER_ROLLBACK;
926 case syncer::NON_RETRIABLE_ERROR:
920 return sync_pb::SyncEnums::UNKNOWN; 927 return sync_pb::SyncEnums::UNKNOWN;
921 } 928 }
929 return sync_pb::SyncEnums::UNKNOWN;
922 } 930 }
923 931
924 sync_pb::SyncEnums::Action GetClientToServerResponseAction( 932 sync_pb::SyncEnums::Action GetClientToServerResponseAction(
925 const syncer::ClientAction& action) { 933 const syncer::ClientAction& action) {
926 switch (action) { 934 switch (action) {
927 case syncer::UPGRADE_CLIENT: 935 case syncer::UPGRADE_CLIENT:
928 return sync_pb::SyncEnums::UPGRADE_CLIENT; 936 return sync_pb::SyncEnums::UPGRADE_CLIENT;
929 case syncer::CLEAR_USER_DATA_AND_RESYNC: 937 case syncer::CLEAR_USER_DATA_AND_RESYNC:
930 return sync_pb::SyncEnums::CLEAR_USER_DATA_AND_RESYNC; 938 return sync_pb::SyncEnums::CLEAR_USER_DATA_AND_RESYNC;
931 case syncer::ENABLE_SYNC_ON_ACCOUNT: 939 case syncer::ENABLE_SYNC_ON_ACCOUNT:
932 return sync_pb::SyncEnums::ENABLE_SYNC_ON_ACCOUNT; 940 return sync_pb::SyncEnums::ENABLE_SYNC_ON_ACCOUNT;
933 case syncer::STOP_AND_RESTART_SYNC: 941 case syncer::STOP_AND_RESTART_SYNC:
934 return sync_pb::SyncEnums::STOP_AND_RESTART_SYNC; 942 return sync_pb::SyncEnums::STOP_AND_RESTART_SYNC;
935 case syncer::DISABLE_SYNC_ON_CLIENT: 943 case syncer::DISABLE_SYNC_ON_CLIENT:
936 return sync_pb::SyncEnums::DISABLE_SYNC_ON_CLIENT; 944 return sync_pb::SyncEnums::DISABLE_SYNC_ON_CLIENT;
945 case syncer::STOP_SYNC_FOR_DISABLED_ACCOUNT:
946 case syncer::DISABLE_SYNC_AND_ROLLBACK:
947 NOTREACHED(); // No corresponding proto action for these. Shouldn't
948 // test.
949 return sync_pb::SyncEnums::UNKNOWN_ACTION;
937 case syncer::UNKNOWN_ACTION: 950 case syncer::UNKNOWN_ACTION:
938 return sync_pb::SyncEnums::UNKNOWN_ACTION; 951 return sync_pb::SyncEnums::UNKNOWN_ACTION;
939 default:
940 NOTREACHED();
941 return sync_pb::SyncEnums::UNKNOWN_ACTION;
942 } 952 }
953 return sync_pb::SyncEnums::UNKNOWN_ACTION;
943 } 954 }
944 955
945 } // namespace 956 } // namespace
946 957
947 void SyncTest::TriggerSyncError(const syncer::SyncProtocolError& error, 958 void SyncTest::TriggerSyncError(const syncer::SyncProtocolError& error,
948 SyncErrorFrequency frequency) { 959 SyncErrorFrequency frequency) {
949 ASSERT_TRUE(ServerSupportsErrorTriggering()); 960 ASSERT_TRUE(ServerSupportsErrorTriggering());
950 std::string path = "chromiumsync/error"; 961 std::string path = "chromiumsync/error";
951 int error_type = 962 int error_type =
952 static_cast<int>(GetClientToServerResponseErrorType( 963 static_cast<int>(GetClientToServerResponseErrorType(
(...skipping 27 matching lines...) Expand all
980 991
981 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, 992 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter,
982 const net::ProxyConfig& proxy_config) { 993 const net::ProxyConfig& proxy_config) {
983 base::WaitableEvent done(false, false); 994 base::WaitableEvent done(false, false);
984 BrowserThread::PostTask( 995 BrowserThread::PostTask(
985 BrowserThread::IO, FROM_HERE, 996 BrowserThread::IO, FROM_HERE,
986 base::Bind(&SetProxyConfigCallback, &done, 997 base::Bind(&SetProxyConfigCallback, &done,
987 make_scoped_refptr(context_getter), proxy_config)); 998 make_scoped_refptr(context_getter), proxy_config));
988 done.Wait(); 999 done.Wait();
989 } 1000 }
OLDNEW
« no previous file with comments | « no previous file | sync/engine/syncer_proto_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698