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

Side by Side Diff: chrome/browser/supervised_user/legacy/supervised_user_shared_settings_update_unittest.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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/legacy/supervised_user_shared_settings_ update.h" 5 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_ update.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_ service.h" 10 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_ service.h"
(...skipping 14 matching lines...) Expand all
25 protected: 25 protected:
26 content::TestBrowserThreadBundle thread_bundle_; 26 content::TestBrowserThreadBundle thread_bundle_;
27 TestingProfile profile_; 27 TestingProfile profile_;
28 SupervisedUserSharedSettingsService service_; 28 SupervisedUserSharedSettingsService service_;
29 std::unique_ptr<bool> result_; 29 std::unique_ptr<bool> result_;
30 }; 30 };
31 31
32 TEST_F(SupervisedUserSharedSettingsUpdateTest, Success) { 32 TEST_F(SupervisedUserSharedSettingsUpdateTest, Success) {
33 SupervisedUserSharedSettingsUpdate update( 33 SupervisedUserSharedSettingsUpdate update(
34 &service_, "abcdef", "name", 34 &service_, "abcdef", "name",
35 std::unique_ptr<base::Value>(new base::StringValue("Hans Moleman")), 35 std::unique_ptr<base::Value>(new base::Value("Hans Moleman")),
36 base::Bind(&SupervisedUserSharedSettingsUpdateTest::OnSettingUpdated, 36 base::Bind(&SupervisedUserSharedSettingsUpdateTest::OnSettingUpdated,
37 base::Unretained(this))); 37 base::Unretained(this)));
38 syncer::SyncChangeList changes; 38 syncer::SyncChangeList changes;
39 changes.push_back(syncer::SyncChange( 39 changes.push_back(syncer::SyncChange(
40 FROM_HERE, 40 FROM_HERE, syncer::SyncChange::ACTION_UPDATE,
41 syncer::SyncChange::ACTION_UPDATE,
42 SupervisedUserSharedSettingsService::CreateSyncDataForSetting( 41 SupervisedUserSharedSettingsService::CreateSyncDataForSetting(
43 "abcdef", "name", base::StringValue("Hans Moleman"), true))); 42 "abcdef", "name", base::Value("Hans Moleman"), true)));
44 syncer::SyncError error = service_.ProcessSyncChanges(FROM_HERE, changes); 43 syncer::SyncError error = service_.ProcessSyncChanges(FROM_HERE, changes);
45 EXPECT_FALSE(error.IsSet()) << error.ToString(); 44 EXPECT_FALSE(error.IsSet()) << error.ToString();
46 ASSERT_TRUE(result_); 45 ASSERT_TRUE(result_);
47 EXPECT_TRUE(*result_); 46 EXPECT_TRUE(*result_);
48 } 47 }
49 48
50 TEST_F(SupervisedUserSharedSettingsUpdateTest, Failure) { 49 TEST_F(SupervisedUserSharedSettingsUpdateTest, Failure) {
51 SupervisedUserSharedSettingsUpdate update( 50 SupervisedUserSharedSettingsUpdate update(
52 &service_, "abcdef", "name", 51 &service_, "abcdef", "name",
53 std::unique_ptr<base::Value>(new base::StringValue("Hans Moleman")), 52 std::unique_ptr<base::Value>(new base::Value("Hans Moleman")),
54 base::Bind(&SupervisedUserSharedSettingsUpdateTest::OnSettingUpdated, 53 base::Bind(&SupervisedUserSharedSettingsUpdateTest::OnSettingUpdated,
55 base::Unretained(this))); 54 base::Unretained(this)));
56 55
57 // Syncing down a different change will cause the update to fail. 56 // Syncing down a different change will cause the update to fail.
58 syncer::SyncChangeList changes; 57 syncer::SyncChangeList changes;
59 changes.push_back(syncer::SyncChange( 58 changes.push_back(syncer::SyncChange(
60 FROM_HERE, 59 FROM_HERE, syncer::SyncChange::ACTION_UPDATE,
61 syncer::SyncChange::ACTION_UPDATE,
62 SupervisedUserSharedSettingsService::CreateSyncDataForSetting( 60 SupervisedUserSharedSettingsService::CreateSyncDataForSetting(
63 "abcdef", 61 "abcdef", "name", base::Value("Barney Gumble"), true)));
64 "name",
65 base::StringValue("Barney Gumble"),
66 true)));
67 syncer::SyncError error = service_.ProcessSyncChanges(FROM_HERE, changes); 62 syncer::SyncError error = service_.ProcessSyncChanges(FROM_HERE, changes);
68 EXPECT_FALSE(error.IsSet()) << error.ToString(); 63 EXPECT_FALSE(error.IsSet()) << error.ToString();
69 ASSERT_TRUE(result_); 64 ASSERT_TRUE(result_);
70 EXPECT_FALSE(*result_); 65 EXPECT_FALSE(*result_);
71 } 66 }
72 67
73 TEST_F(SupervisedUserSharedSettingsUpdateTest, Cancel) { 68 TEST_F(SupervisedUserSharedSettingsUpdateTest, Cancel) {
74 { 69 {
75 SupervisedUserSharedSettingsUpdate update( 70 SupervisedUserSharedSettingsUpdate update(
76 &service_, "abcdef", "name", 71 &service_, "abcdef", "name",
77 std::unique_ptr<base::Value>(new base::StringValue("Hans Moleman")), 72 std::unique_ptr<base::Value>(new base::Value("Hans Moleman")),
78 base::Bind(&SupervisedUserSharedSettingsUpdateTest::OnSettingUpdated, 73 base::Bind(&SupervisedUserSharedSettingsUpdateTest::OnSettingUpdated,
79 base::Unretained(this))); 74 base::Unretained(this)));
80 ASSERT_FALSE(result_); 75 ASSERT_FALSE(result_);
81 } 76 }
82 ASSERT_FALSE(result_); 77 ASSERT_FALSE(result_);
83 } 78 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698