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

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

Issue 11961030: [Sync] Make SESSIONS an implicit type (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 7 years, 10 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) 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/profile_sync_service_harness.h" 5 #include "chrome/browser/sync/profile_sync_service_harness.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <iterator> 8 #include <iterator>
9 #include <ostream> 9 #include <ostream>
10 #include <set> 10 #include <set>
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/sync/about_sync_util.h" 25 #include "chrome/browser/sync/about_sync_util.h"
26 #include "chrome/browser/sync/glue/data_type_controller.h" 26 #include "chrome/browser/sync/glue/data_type_controller.h"
27 #include "chrome/browser/sync/profile_sync_service_factory.h" 27 #include "chrome/browser/sync/profile_sync_service_factory.h"
28 #include "chrome/common/chrome_switches.h" 28 #include "chrome/common/chrome_switches.h"
29 #include "sync/internal_api/public/base/progress_marker_map.h" 29 #include "sync/internal_api/public/base/progress_marker_map.h"
30 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" 30 #include "sync/internal_api/public/sessions/sync_session_snapshot.h"
31 #include "sync/internal_api/public/util/sync_string_conversions.h" 31 #include "sync/internal_api/public/util/sync_string_conversions.h"
32 32
33 using syncer::sessions::SyncSessionSnapshot; 33 using syncer::sessions::SyncSessionSnapshot;
34 34
35 namespace {
36
35 // TODO(rsimha): Remove the following lines once crbug.com/91863 is fixed. 37 // TODO(rsimha): Remove the following lines once crbug.com/91863 is fixed.
36 // The amount of time for which we wait for a live sync operation to complete. 38 // The amount of time for which we wait for a live sync operation to complete.
37 static const int kLiveSyncOperationTimeoutMs = 45000; 39 static const int kLiveSyncOperationTimeoutMs = 45000;
38 40
39 // The amount of time we wait for test cases that verify exponential backoff. 41 // The amount of time we wait for test cases that verify exponential backoff.
40 static const int kExponentialBackoffVerificationTimeoutMs = 60000; 42 static const int kExponentialBackoffVerificationTimeoutMs = 60000;
41 43
44 syncer::ModelTypeSet GetUserVisibleTypes() {
45 syncer::ModelTypeSet user_visible_types(syncer::UserTypes());
46 user_visible_types.Remove(syncer::APP_NOTIFICATIONS);
47 user_visible_types.Remove(syncer::APP_SETTINGS);
48 user_visible_types.Remove(syncer::AUTOFILL_PROFILE);
49 user_visible_types.Remove(syncer::EXTENSION_SETTINGS);
50 user_visible_types.Remove(syncer::SEARCH_ENGINES);
51 user_visible_types.Remove(syncer::SESSIONS);
52 user_visible_types.Remove(syncer::HISTORY_DELETE_DIRECTIVES);
53 return user_visible_types;
54 }
55
56 }
57
42 // Simple class to implement a timeout using PostDelayedTask. If it is not 58 // Simple class to implement a timeout using PostDelayedTask. If it is not
43 // aborted before picked up by a message queue, then it asserts with the message 59 // aborted before picked up by a message queue, then it asserts with the message
44 // provided. This class is not thread safe. 60 // provided. This class is not thread safe.
45 class StateChangeTimeoutEvent 61 class StateChangeTimeoutEvent
46 : public base::RefCountedThreadSafe<StateChangeTimeoutEvent> { 62 : public base::RefCountedThreadSafe<StateChangeTimeoutEvent> {
47 public: 63 public:
48 StateChangeTimeoutEvent(ProfileSyncServiceHarness* caller, 64 StateChangeTimeoutEvent(ProfileSyncServiceHarness* caller,
49 const std::string& message); 65 const std::string& message);
50 66
51 // The entry point to the class from PostDelayedTask. 67 // The entry point to the class from PostDelayedTask.
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 } 957 }
942 958
943 syncer::ModelTypeSet synced_datatypes = service()->GetPreferredDataTypes(); 959 syncer::ModelTypeSet synced_datatypes = service()->GetPreferredDataTypes();
944 if (!synced_datatypes.Has(datatype)) { 960 if (!synced_datatypes.Has(datatype)) {
945 DVLOG(1) << "DisableSyncForDatatype(): Sync already disabled for datatype " 961 DVLOG(1) << "DisableSyncForDatatype(): Sync already disabled for datatype "
946 << syncer::ModelTypeToString(datatype) 962 << syncer::ModelTypeToString(datatype)
947 << " on " << profile_debug_name_ << "."; 963 << " on " << profile_debug_name_ << ".";
948 return true; 964 return true;
949 } 965 }
950 966
967 synced_datatypes.RetainAll(GetUserVisibleTypes());
951 synced_datatypes.Remove(datatype); 968 synced_datatypes.Remove(datatype);
952 service()->OnUserChoseDatatypes(false, synced_datatypes); 969 service()->OnUserChoseDatatypes(false, synced_datatypes);
953 if (AwaitFullSyncCompletion("Datatype reconfiguration.")) { 970 if (AwaitFullSyncCompletion("Datatype reconfiguration.")) {
954 DVLOG(1) << "DisableSyncForDatatype(): Disabled sync for datatype " 971 DVLOG(1) << "DisableSyncForDatatype(): Disabled sync for datatype "
955 << syncer::ModelTypeToString(datatype) 972 << syncer::ModelTypeToString(datatype)
956 << " on " << profile_debug_name_ << "."; 973 << " on " << profile_debug_name_ << ".";
957 return true; 974 return true;
958 } 975 }
959 976
960 DVLOG(0) << GetClientInfoString("DisableSyncForDatatype failed"); 977 DVLOG(0) << GetClientInfoString("DisableSyncForDatatype failed");
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 1142
1126 std::string ProfileSyncServiceHarness::GetServiceStatus() { 1143 std::string ProfileSyncServiceHarness::GetServiceStatus() {
1127 scoped_ptr<DictionaryValue> value( 1144 scoped_ptr<DictionaryValue> value(
1128 sync_ui_util::ConstructAboutInformation(service_)); 1145 sync_ui_util::ConstructAboutInformation(service_));
1129 std::string service_status; 1146 std::string service_status;
1130 base::JSONWriter::WriteWithOptions(value.get(), 1147 base::JSONWriter::WriteWithOptions(value.get(),
1131 base::JSONWriter::OPTIONS_PRETTY_PRINT, 1148 base::JSONWriter::OPTIONS_PRETTY_PRINT,
1132 &service_status); 1149 &service_status);
1133 return service_status; 1150 return service_status;
1134 } 1151 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698