| 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 <map> | 5 #include <map> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/sync/glue/sync_backend_host.h" | 28 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 29 #include "chrome/browser/sync/glue/ui_data_type_controller.h" | 29 #include "chrome/browser/sync/glue/ui_data_type_controller.h" |
| 30 #include "chrome/browser/sync/profile_sync_service_factory.h" | 30 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 31 #include "chrome/browser/sync/profile_sync_test_util.h" | 31 #include "chrome/browser/sync/profile_sync_test_util.h" |
| 32 #include "chrome/browser/sync/test_profile_sync_service.h" | 32 #include "chrome/browser/sync/test_profile_sync_service.h" |
| 33 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/test/base/testing_pref_service_syncable.h" | 34 #include "chrome/test/base/testing_pref_service_syncable.h" |
| 35 #include "chrome/test/base/testing_profile.h" | 35 #include "chrome/test/base/testing_profile.h" |
| 36 #include "components/user_prefs/pref_registry_syncable.h" | 36 #include "components/user_prefs/pref_registry_syncable.h" |
| 37 #include "google_apis/gaia/gaia_constants.h" | 37 #include "google_apis/gaia/gaia_constants.h" |
| 38 #include "sync/api/attachments/fake_attachment_service.h" |
| 38 #include "sync/api/sync_data.h" | 39 #include "sync/api/sync_data.h" |
| 39 #include "sync/internal_api/public/base/model_type.h" | 40 #include "sync/internal_api/public/base/model_type.h" |
| 40 #include "sync/internal_api/public/change_record.h" | 41 #include "sync/internal_api/public/change_record.h" |
| 41 #include "sync/internal_api/public/data_type_debug_info_listener.h" | 42 #include "sync/internal_api/public/data_type_debug_info_listener.h" |
| 42 #include "sync/internal_api/public/read_node.h" | 43 #include "sync/internal_api/public/read_node.h" |
| 43 #include "sync/internal_api/public/read_transaction.h" | 44 #include "sync/internal_api/public/read_transaction.h" |
| 44 #include "sync/internal_api/public/write_node.h" | 45 #include "sync/internal_api/public/write_node.h" |
| 45 #include "sync/internal_api/public/write_transaction.h" | 46 #include "sync/internal_api/public/write_transaction.h" |
| 46 #include "sync/protocol/preference_specifics.pb.h" | 47 #include "sync/protocol/preference_specifics.pb.h" |
| 47 #include "testing/gmock/include/gmock/gmock.h" | 48 #include "testing/gmock/include/gmock/gmock.h" |
| 48 #include "testing/gtest/include/gtest/gtest.h" | 49 #include "testing/gtest/include/gtest/gtest.h" |
| 49 | 50 |
| 50 using base::JSONReader; | 51 using base::JSONReader; |
| 51 using browser_sync::GenericChangeProcessor; | 52 using browser_sync::GenericChangeProcessor; |
| 52 using browser_sync::SharedChangeProcessor; | 53 using browser_sync::SharedChangeProcessor; |
| 53 using browser_sync::UIDataTypeController; | 54 using browser_sync::UIDataTypeController; |
| 54 using syncer::ChangeRecord; | 55 using syncer::ChangeRecord; |
| 55 using testing::Invoke; | 56 using testing::Invoke; |
| 56 using testing::Return; | 57 using testing::Return; |
| 57 using testing::_; | 58 using testing::_; |
| 58 | 59 |
| 59 typedef std::map<const std::string, const base::Value*> PreferenceValues; | 60 typedef std::map<const std::string, const base::Value*> PreferenceValues; |
| 60 | 61 |
| 61 ACTION_P(CreateAndSaveChangeProcessor, change_processor) { | 62 ACTION_P(CreateAndSaveChangeProcessor, change_processor) { |
| 62 syncer::UserShare* user_share = arg0->GetUserShare(); | 63 syncer::UserShare* user_share = arg0->GetUserShare(); |
| 63 *change_processor = new GenericChangeProcessor(arg1, | 64 *change_processor = new GenericChangeProcessor( |
| 64 arg2, | 65 arg1, |
| 65 arg3, | 66 arg2, |
| 66 user_share); | 67 arg3, |
| 68 user_share, |
| 69 syncer::FakeAttachmentService::CreateForTest()); |
| 67 return *change_processor; | 70 return *change_processor; |
| 68 } | 71 } |
| 69 | 72 |
| 70 ACTION_P(ReturnNewDataTypeManagerWithDebugListener, debug_listener) { | 73 ACTION_P(ReturnNewDataTypeManagerWithDebugListener, debug_listener) { |
| 71 return new browser_sync::DataTypeManagerImpl( | 74 return new browser_sync::DataTypeManagerImpl( |
| 72 debug_listener, | 75 debug_listener, |
| 73 arg1, | 76 arg1, |
| 74 arg2, | 77 arg2, |
| 75 arg3, | 78 arg3, |
| 76 arg4, | 79 arg4, |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 EXPECT_FALSE(pref->IsDefaultValue()); | 886 EXPECT_FALSE(pref->IsDefaultValue()); |
| 884 // There should be no synced value. | 887 // There should be no synced value. |
| 885 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); | 888 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); |
| 886 // Switch kHomePage back to unmanaged. | 889 // Switch kHomePage back to unmanaged. |
| 887 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); | 890 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); |
| 888 // The original value should be picked up. | 891 // The original value should be picked up. |
| 889 EXPECT_TRUE(pref->IsDefaultValue()); | 892 EXPECT_TRUE(pref->IsDefaultValue()); |
| 890 // There should still be no synced value. | 893 // There should still be no synced value. |
| 891 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); | 894 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); |
| 892 } | 895 } |
| OLD | NEW |