OLD | NEW |
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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 virtual void TearDown() OVERRIDE { | 142 virtual void TearDown() OVERRIDE { |
143 frontend_.reset(); | 143 frontend_.reset(); |
144 profile_.reset(); | 144 profile_.reset(); |
145 } | 145 } |
146 | 146 |
147 protected: | 147 protected: |
148 // Adds a record of an extension or app to the extension service, then returns | 148 // Adds a record of an extension or app to the extension service, then returns |
149 // its storage area. | 149 // its storage area. |
150 SettingsStorage* AddExtensionAndGetStorage( | 150 SettingsStorage* AddExtensionAndGetStorage( |
151 const std::string& id, Extension::Type type) { | 151 const std::string& id, Extension::Type type) { |
152 profile_->GetMockExtensionService()->AddExtension(id, type); | 152 profile_->GetMockExtensionService()->AddExtensionWithId(id, type); |
153 return GetStorage(id, frontend_.get()); | 153 return GetStorage(id, frontend_.get()); |
154 } | 154 } |
155 | 155 |
156 // Gets the SyncableService for the given sync type. | 156 // Gets the SyncableService for the given sync type. |
157 SyncableService* GetSyncableService(syncable::ModelType model_type) { | 157 SyncableService* GetSyncableService(syncable::ModelType model_type) { |
158 SyncableService* settings_service = NULL; | 158 SyncableService* settings_service = NULL; |
159 frontend_->RunWithSyncableService( | 159 frontend_->RunWithSyncableService( |
160 model_type, base::Bind(&AssignSettingsService, &settings_service)); | 160 model_type, base::Bind(&AssignSettingsService, &settings_service)); |
161 MessageLoop::current()->RunAllPending(); | 161 MessageLoop::current()->RunAllPending(); |
162 return settings_service; | 162 return settings_service; |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 "s2", "bar", value2)); | 581 "s2", "bar", value2)); |
582 | 582 |
583 GetSyncableService(syncable::APP_SETTINGS)-> | 583 GetSyncableService(syncable::APP_SETTINGS)-> |
584 MergeDataAndStartSyncing(syncable::APP_SETTINGS, sync_data, &sync_); | 584 MergeDataAndStartSyncing(syncable::APP_SETTINGS, sync_data, &sync_); |
585 GetSyncableService(syncable::APP_SETTINGS)-> | 585 GetSyncableService(syncable::APP_SETTINGS)-> |
586 StopSyncing(syncable::APP_SETTINGS); | 586 StopSyncing(syncable::APP_SETTINGS); |
587 ASSERT_EQ(0u, sync_.changes().size()); | 587 ASSERT_EQ(0u, sync_.changes().size()); |
588 } | 588 } |
589 | 589 |
590 } // namespace extensions | 590 } // namespace extensions |
OLD | NEW |