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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc

Issue 1551503002: Convert Pass()→std::move() in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/supervised_user/supervised_user_settings_service.h"
6
7 #include <utility>
8
5 #include "base/bind.h" 9 #include "base/bind.h"
6 #include "base/callback.h" 10 #include "base/callback.h"
7 #include "base/json/json_reader.h" 11 #include "base/json/json_reader.h"
8 #include "base/macros.h" 12 #include "base/macros.h"
9 #include "base/prefs/testing_pref_store.h" 13 #include "base/prefs/testing_pref_store.h"
10 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
11 #include "chrome/browser/supervised_user/supervised_user_settings_service.h"
12 #include "content/public/test/test_browser_thread_bundle.h" 15 #include "content/public/test/test_browser_thread_bundle.h"
13 #include "sync/api/fake_sync_change_processor.h" 16 #include "sync/api/fake_sync_change_processor.h"
14 #include "sync/api/sync_change.h" 17 #include "sync/api/sync_change.h"
15 #include "sync/api/sync_change_processor_wrapper_for_test.h" 18 #include "sync/api/sync_change_processor_wrapper_for_test.h"
16 #include "sync/api/sync_error_factory_mock.h" 19 #include "sync/api/sync_error_factory_mock.h"
17 #include "sync/protocol/sync.pb.h" 20 #include "sync/protocol/sync.pb.h"
18 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
19 22
20 namespace { 23 namespace {
21 24
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 scoped_ptr<syncer::SyncChangeProcessor> CreateSyncProcessor() { 67 scoped_ptr<syncer::SyncChangeProcessor> CreateSyncProcessor() {
65 sync_processor_.reset(new syncer::FakeSyncChangeProcessor); 68 sync_processor_.reset(new syncer::FakeSyncChangeProcessor);
66 return scoped_ptr<syncer::SyncChangeProcessor>( 69 return scoped_ptr<syncer::SyncChangeProcessor>(
67 new syncer::SyncChangeProcessorWrapperForTest(sync_processor_.get())); 70 new syncer::SyncChangeProcessorWrapperForTest(sync_processor_.get()));
68 } 71 }
69 72
70 void StartSyncing(const syncer::SyncDataList& initial_sync_data) { 73 void StartSyncing(const syncer::SyncDataList& initial_sync_data) {
71 scoped_ptr<syncer::SyncErrorFactory> error_handler( 74 scoped_ptr<syncer::SyncErrorFactory> error_handler(
72 new MockSyncErrorFactory(syncer::SUPERVISED_USER_SETTINGS)); 75 new MockSyncErrorFactory(syncer::SUPERVISED_USER_SETTINGS));
73 syncer::SyncMergeResult result = settings_service_.MergeDataAndStartSyncing( 76 syncer::SyncMergeResult result = settings_service_.MergeDataAndStartSyncing(
74 syncer::SUPERVISED_USER_SETTINGS, 77 syncer::SUPERVISED_USER_SETTINGS, initial_sync_data,
75 initial_sync_data, 78 CreateSyncProcessor(), std::move(error_handler));
76 CreateSyncProcessor(),
77 error_handler.Pass());
78 EXPECT_FALSE(result.error().IsSet()); 79 EXPECT_FALSE(result.error().IsSet());
79 } 80 }
80 81
81 void UploadSplitItem(const std::string& key, const std::string& value) { 82 void UploadSplitItem(const std::string& key, const std::string& value) {
82 split_items_.SetStringWithoutPathExpansion(key, value); 83 split_items_.SetStringWithoutPathExpansion(key, value);
83 settings_service_.UploadItem( 84 settings_service_.UploadItem(
84 SupervisedUserSettingsService::MakeSplitSettingKey(kSplitItemName, 85 SupervisedUserSettingsService::MakeSplitSettingKey(kSplitItemName,
85 key), 86 key),
86 scoped_ptr<base::Value>(new base::StringValue(value))); 87 scoped_ptr<base::Value>(new base::StringValue(value)));
87 } 88 }
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 // The uploaded items should not show up as settings. 286 // The uploaded items should not show up as settings.
286 const base::Value* value = NULL; 287 const base::Value* value = NULL;
287 EXPECT_FALSE(settings_->GetWithoutPathExpansion(kAtomicItemName, &value)); 288 EXPECT_FALSE(settings_->GetWithoutPathExpansion(kAtomicItemName, &value));
288 EXPECT_FALSE(settings_->GetWithoutPathExpansion(kSplitItemName, &value)); 289 EXPECT_FALSE(settings_->GetWithoutPathExpansion(kSplitItemName, &value));
289 290
290 // Restarting sync should not create any new changes. 291 // Restarting sync should not create any new changes.
291 settings_service_.StopSyncing(syncer::SUPERVISED_USER_SETTINGS); 292 settings_service_.StopSyncing(syncer::SUPERVISED_USER_SETTINGS);
292 StartSyncing(sync_data); 293 StartSyncing(sync_data);
293 ASSERT_EQ(0u, sync_processor_->changes().size()); 294 ASSERT_EQ(0u, sync_processor_->changes().size());
294 } 295 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698