| 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_MANAGED_USER_TEST_BASE_H_ | 4 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_MANAGED_USER_TEST_BASE_H_ |
| 5 #define CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_MANAGED_USER_TEST_BASE_H_ | 5 #define CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_MANAGED_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 "chrome/browser/chromeos/login/login_manager_test.h" | 10 #include "chrome/browser/chromeos/login/login_manager_test.h" |
| 11 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" | 11 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" |
| 12 #include "chrome/browser/managed_mode/managed_user_registration_utility_stub.h" | |
| 13 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/supervised_user/supervised_user_registration_utility_st
ub.h" |
| 14 #include "chromeos/cryptohome/mock_async_method_caller.h" | 14 #include "chromeos/cryptohome/mock_async_method_caller.h" |
| 15 #include "chromeos/cryptohome/mock_homedir_methods.h" | 15 #include "chromeos/cryptohome/mock_homedir_methods.h" |
| 16 #include "sync/api/fake_sync_change_processor.h" | 16 #include "sync/api/fake_sync_change_processor.h" |
| 17 #include "sync/api/sync_change.h" | 17 #include "sync/api/sync_change.h" |
| 18 #include "sync/api/sync_error_factory_mock.h" | 18 #include "sync/api/sync_error_factory_mock.h" |
| 19 #include "sync/protocol/sync.pb.h" | 19 #include "sync/protocol/sync.pb.h" |
| 20 | 20 |
| 21 namespace chromeos { | 21 namespace chromeos { |
| 22 | 22 |
| 23 const char kStubEthernetServicePath[] = "eth0"; | 23 const char kStubEthernetServicePath[] = "eth0"; |
| 24 | 24 |
| 25 const char kTestManager[] = "test-manager@gmail.com"; | 25 const char kTestManager[] = "test-manager@gmail.com"; |
| 26 const char kTestOtherUser[] = "test-user@gmail.com"; | 26 const char kTestOtherUser[] = "test-user@gmail.com"; |
| 27 | 27 |
| 28 const char kTestManagerPassword[] = "password"; | 28 const char kTestManagerPassword[] = "password"; |
| 29 const char kTestSupervisedUserDisplayName[] = "John Doe"; | 29 const char kTestSupervisedUserDisplayName[] = "John Doe"; |
| 30 const char kTestSupervisedUserPassword[] = "simplepassword"; | 30 const char kTestSupervisedUserPassword[] = "simplepassword"; |
| 31 | 31 |
| 32 class ManagedUsersSyncTestAdapter { | 32 class ManagedUsersSyncTestAdapter { |
| 33 public: | 33 public: |
| 34 explicit ManagedUsersSyncTestAdapter(Profile* profile); | 34 explicit ManagedUsersSyncTestAdapter(Profile* profile); |
| 35 | 35 |
| 36 bool HasChanges() { return !processor_->changes().empty(); } | 36 bool HasChanges() { return !processor_->changes().empty(); } |
| 37 | 37 |
| 38 scoped_ptr< ::sync_pb::ManagedUserSpecifics> GetFirstChange(); | 38 scoped_ptr< ::sync_pb::ManagedUserSpecifics> GetFirstChange(); |
| 39 | 39 |
| 40 void AddChange(const ::sync_pb::ManagedUserSpecifics& proto, bool update); | 40 void AddChange(const ::sync_pb::ManagedUserSpecifics& proto, bool update); |
| 41 | 41 |
| 42 syncer::FakeSyncChangeProcessor* processor_; | 42 syncer::FakeSyncChangeProcessor* processor_; |
| 43 ManagedUserSyncService* service_; | 43 SupervisedUserSyncService* service_; |
| 44 int next_sync_data_id_; | 44 int next_sync_data_id_; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 class ManagedUsersSharedSettingsSyncTestAdapter { | 47 class ManagedUsersSharedSettingsSyncTestAdapter { |
| 48 public: | 48 public: |
| 49 explicit ManagedUsersSharedSettingsSyncTestAdapter(Profile* profile); | 49 explicit ManagedUsersSharedSettingsSyncTestAdapter(Profile* profile); |
| 50 | 50 |
| 51 bool HasChanges() { return !processor_->changes().empty(); } | 51 bool HasChanges() { return !processor_->changes().empty(); } |
| 52 | 52 |
| 53 scoped_ptr< ::sync_pb::ManagedUserSharedSettingSpecifics> GetFirstChange(); | 53 scoped_ptr< ::sync_pb::ManagedUserSharedSettingSpecifics> GetFirstChange(); |
| 54 | 54 |
| 55 void AddChange(const ::sync_pb::ManagedUserSharedSettingSpecifics& proto, | 55 void AddChange(const ::sync_pb::ManagedUserSharedSettingSpecifics& proto, |
| 56 bool update); | 56 bool update); |
| 57 | 57 |
| 58 void AddChange(const std::string& mu_id, | 58 void AddChange(const std::string& mu_id, |
| 59 const std::string& key, | 59 const std::string& key, |
| 60 const base::Value& value, | 60 const base::Value& value, |
| 61 bool acknowledged, | 61 bool acknowledged, |
| 62 bool update); | 62 bool update); |
| 63 | 63 |
| 64 syncer::FakeSyncChangeProcessor* processor_; | 64 syncer::FakeSyncChangeProcessor* processor_; |
| 65 ManagedUserSharedSettingsService* service_; | 65 SupervisedUserSharedSettingsService* service_; |
| 66 int next_sync_data_id_; | 66 int next_sync_data_id_; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 class ManagedUserTestBase : public chromeos::LoginManagerTest { | 69 class ManagedUserTestBase : public chromeos::LoginManagerTest { |
| 70 public: | 70 public: |
| 71 ManagedUserTestBase(); | 71 ManagedUserTestBase(); |
| 72 virtual ~ManagedUserTestBase(); | 72 virtual ~ManagedUserTestBase(); |
| 73 | 73 |
| 74 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; | 74 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; |
| 75 virtual void CleanUpOnMainThread() OVERRIDE; | 75 virtual void CleanUpOnMainThread() OVERRIDE; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 95 int user_index, | 95 int user_index, |
| 96 const std::string& expected_display_name); | 96 const std::string& expected_display_name); |
| 97 void SigninAsManager(int user_index); | 97 void SigninAsManager(int user_index); |
| 98 void RemoveSupervisedUser(unsigned long original_user_count, | 98 void RemoveSupervisedUser(unsigned long original_user_count, |
| 99 int user_index, | 99 int user_index, |
| 100 const std::string& expected_display_name); | 100 const std::string& expected_display_name); |
| 101 | 101 |
| 102 cryptohome::MockAsyncMethodCaller* mock_async_method_caller_; | 102 cryptohome::MockAsyncMethodCaller* mock_async_method_caller_; |
| 103 cryptohome::MockHomedirMethods* mock_homedir_methods_; | 103 cryptohome::MockHomedirMethods* mock_homedir_methods_; |
| 104 NetworkPortalDetectorTestImpl* network_portal_detector_; | 104 NetworkPortalDetectorTestImpl* network_portal_detector_; |
| 105 ManagedUserRegistrationUtilityStub* registration_utility_stub_; | 105 SupervisedUserRegistrationUtilityStub* registration_utility_stub_; |
| 106 scoped_ptr<ScopedTestingManagedUserRegistrationUtility> scoped_utility_; | 106 scoped_ptr<ScopedTestingSupervisedUserRegistrationUtility> scoped_utility_; |
| 107 scoped_ptr<ManagedUsersSharedSettingsSyncTestAdapter> | 107 scoped_ptr<ManagedUsersSharedSettingsSyncTestAdapter> |
| 108 shared_settings_adapter_; | 108 shared_settings_adapter_; |
| 109 scoped_ptr<ManagedUsersSyncTestAdapter> managed_users_adapter_; | 109 scoped_ptr<ManagedUsersSyncTestAdapter> managed_users_adapter_; |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 DISALLOW_COPY_AND_ASSIGN(ManagedUserTestBase); | 112 DISALLOW_COPY_AND_ASSIGN(ManagedUserTestBase); |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 } // namespace chromeos | 115 } // namespace chromeos |
| 116 | 116 |
| 117 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_MANAGED_USER_TEST_BASE_H_ | 117 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_MANAGED_USER_TEST_BASE_H_ |
| OLD | NEW |