| 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 "chrome/browser/chromeos/login/supervised/supervised_user_test_base.h" | 5 #include "chrome/browser/chromeos/login/supervised/supervised_user_test_base.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 syncer::SUPERVISED_USERS, syncer::SyncDataList(), | 66 syncer::SUPERVISED_USERS, syncer::SyncDataList(), |
| 67 std::unique_ptr<syncer::SyncChangeProcessor>(processor_), | 67 std::unique_ptr<syncer::SyncChangeProcessor>(processor_), |
| 68 std::unique_ptr<syncer::SyncErrorFactory>( | 68 std::unique_ptr<syncer::SyncErrorFactory>( |
| 69 new syncer::SyncErrorFactoryMock)); | 69 new syncer::SyncErrorFactoryMock)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 std::unique_ptr<::sync_pb::ManagedUserSpecifics> | 72 std::unique_ptr<::sync_pb::ManagedUserSpecifics> |
| 73 SupervisedUsersSyncTestAdapter::GetFirstChange() { | 73 SupervisedUsersSyncTestAdapter::GetFirstChange() { |
| 74 std::unique_ptr<::sync_pb::ManagedUserSpecifics> result( | 74 std::unique_ptr<::sync_pb::ManagedUserSpecifics> result( |
| 75 new ::sync_pb::ManagedUserSpecifics); | 75 new ::sync_pb::ManagedUserSpecifics); |
| 76 CHECK(HasChanges()) | 76 // GetFirstChange() should only be callled if HasChanges() is true |
| 77 << "GetFirstChange() should only be callled if HasChanges() is true"; | 77 CHECK(HasChanges()); |
| 78 const syncer::SyncData& data = processor_->changes().front().sync_data(); | 78 const syncer::SyncData& data = processor_->changes().front().sync_data(); |
| 79 EXPECT_EQ(syncer::SUPERVISED_USERS, data.GetDataType()); | 79 EXPECT_EQ(syncer::SUPERVISED_USERS, data.GetDataType()); |
| 80 result->CopyFrom(data.GetSpecifics().managed_user()); | 80 result->CopyFrom(data.GetSpecifics().managed_user()); |
| 81 return result; | 81 return result; |
| 82 } | 82 } |
| 83 | 83 |
| 84 void SupervisedUsersSyncTestAdapter::AddChange( | 84 void SupervisedUsersSyncTestAdapter::AddChange( |
| 85 const ::sync_pb::ManagedUserSpecifics& proto, | 85 const ::sync_pb::ManagedUserSpecifics& proto, |
| 86 bool update) { | 86 bool update) { |
| 87 sync_pb::EntitySpecifics specifics; | 87 sync_pb::EntitySpecifics specifics; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 115 syncer::SUPERVISED_USER_SHARED_SETTINGS, syncer::SyncDataList(), | 115 syncer::SUPERVISED_USER_SHARED_SETTINGS, syncer::SyncDataList(), |
| 116 std::unique_ptr<syncer::SyncChangeProcessor>(processor_), | 116 std::unique_ptr<syncer::SyncChangeProcessor>(processor_), |
| 117 std::unique_ptr<syncer::SyncErrorFactory>( | 117 std::unique_ptr<syncer::SyncErrorFactory>( |
| 118 new syncer::SyncErrorFactoryMock)); | 118 new syncer::SyncErrorFactoryMock)); |
| 119 } | 119 } |
| 120 | 120 |
| 121 std::unique_ptr<::sync_pb::ManagedUserSharedSettingSpecifics> | 121 std::unique_ptr<::sync_pb::ManagedUserSharedSettingSpecifics> |
| 122 SupervisedUsersSharedSettingsSyncTestAdapter::GetFirstChange() { | 122 SupervisedUsersSharedSettingsSyncTestAdapter::GetFirstChange() { |
| 123 std::unique_ptr<::sync_pb::ManagedUserSharedSettingSpecifics> result( | 123 std::unique_ptr<::sync_pb::ManagedUserSharedSettingSpecifics> result( |
| 124 new ::sync_pb::ManagedUserSharedSettingSpecifics); | 124 new ::sync_pb::ManagedUserSharedSettingSpecifics); |
| 125 CHECK(HasChanges()) | 125 // GetFirstChange() should only be callled if HasChanges() is true |
| 126 << "GetFirstChange() should only be callled if HasChanges() is true"; | 126 CHECK(HasChanges()); |
| 127 const syncer::SyncData& data = processor_->changes().front().sync_data(); | 127 const syncer::SyncData& data = processor_->changes().front().sync_data(); |
| 128 EXPECT_EQ(syncer::SUPERVISED_USER_SHARED_SETTINGS, data.GetDataType()); | 128 EXPECT_EQ(syncer::SUPERVISED_USER_SHARED_SETTINGS, data.GetDataType()); |
| 129 result->CopyFrom(data.GetSpecifics().managed_user_shared_setting()); | 129 result->CopyFrom(data.GetSpecifics().managed_user_shared_setting()); |
| 130 return result; | 130 return result; |
| 131 } | 131 } |
| 132 | 132 |
| 133 void SupervisedUsersSharedSettingsSyncTestAdapter::AddChange( | 133 void SupervisedUsersSharedSettingsSyncTestAdapter::AddChange( |
| 134 const ::sync_pb::ManagedUserSharedSettingSpecifics& proto, | 134 const ::sync_pb::ManagedUserSharedSettingSpecifics& proto, |
| 135 bool update) { | 135 bool update) { |
| 136 sync_pb::EntitySpecifics specifics; | 136 sync_pb::EntitySpecifics specifics; |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 JSEval(StringPrintf( | 450 JSEval(StringPrintf( |
| 451 "$('pod-row').pods[%d].querySelector('.remove-warning-button').click()", | 451 "$('pod-row').pods[%d].querySelector('.remove-warning-button').click()", |
| 452 user_index)); | 452 user_index)); |
| 453 | 453 |
| 454 // Make sure there is no supervised user in list. | 454 // Make sure there is no supervised user in list. |
| 455 ASSERT_EQ(original_user_count - 1, | 455 ASSERT_EQ(original_user_count - 1, |
| 456 user_manager::UserManager::Get()->GetUsers().size()); | 456 user_manager::UserManager::Get()->GetUsers().size()); |
| 457 } | 457 } |
| 458 | 458 |
| 459 } // namespace chromeos | 459 } // namespace chromeos |
| OLD | NEW |