| OLD | NEW |
| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_
service.h" | 7 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_
service.h" |
| 8 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_
update.h" | 8 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_
update.h" |
| 9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
| 10 #include "content/public/test/test_browser_thread_bundle.h" |
| 10 #include "sync/api/sync_change.h" | 11 #include "sync/api/sync_change.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 class SupervisedUserSharedSettingsUpdateTest : public testing::Test { | 14 class SupervisedUserSharedSettingsUpdateTest : public testing::Test { |
| 14 public: | 15 public: |
| 15 SupervisedUserSharedSettingsUpdateTest() : service_(profile_.GetPrefs()) {} | 16 SupervisedUserSharedSettingsUpdateTest() : service_(profile_.GetPrefs()) {} |
| 16 ~SupervisedUserSharedSettingsUpdateTest() override {} | 17 ~SupervisedUserSharedSettingsUpdateTest() override {} |
| 17 | 18 |
| 18 void OnSettingUpdated(bool success) { | 19 void OnSettingUpdated(bool success) { |
| 19 result_.reset(new bool(success)); | 20 result_.reset(new bool(success)); |
| 20 } | 21 } |
| 21 | 22 |
| 22 protected: | 23 protected: |
| 24 content::TestBrowserThreadBundle thread_bundle_; |
| 23 TestingProfile profile_; | 25 TestingProfile profile_; |
| 24 SupervisedUserSharedSettingsService service_; | 26 SupervisedUserSharedSettingsService service_; |
| 25 scoped_ptr<bool> result_; | 27 scoped_ptr<bool> result_; |
| 26 }; | 28 }; |
| 27 | 29 |
| 28 TEST_F(SupervisedUserSharedSettingsUpdateTest, Success) { | 30 TEST_F(SupervisedUserSharedSettingsUpdateTest, Success) { |
| 29 SupervisedUserSharedSettingsUpdate update( | 31 SupervisedUserSharedSettingsUpdate update( |
| 30 &service_, | 32 &service_, |
| 31 "abcdef", | 33 "abcdef", |
| 32 "name", | 34 "name", |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 &service_, | 78 &service_, |
| 77 "abcdef", | 79 "abcdef", |
| 78 "name", | 80 "name", |
| 79 scoped_ptr<base::Value>(new base::StringValue("Hans Moleman")), | 81 scoped_ptr<base::Value>(new base::StringValue("Hans Moleman")), |
| 80 base::Bind(&SupervisedUserSharedSettingsUpdateTest::OnSettingUpdated, | 82 base::Bind(&SupervisedUserSharedSettingsUpdateTest::OnSettingUpdated, |
| 81 base::Unretained(this))); | 83 base::Unretained(this))); |
| 82 ASSERT_FALSE(result_); | 84 ASSERT_FALSE(result_); |
| 83 } | 85 } |
| 84 ASSERT_FALSE(result_); | 86 ASSERT_FALSE(result_); |
| 85 } | 87 } |
| OLD | NEW |