| 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_SUPERVISED_SUPERVISED_USER_TEST_BASE_H_ |
| 5 #define CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_MANAGED_USER_TEST_BASE_H_ | 5 #define 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 "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/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/supervised_user/supervised_user_registration_utility_st
ub.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 kTestManager[] = "test-manager@gmail.com"; | 23 const char kTestManager[] = "test-manager@gmail.com"; |
| 24 const char kTestOtherUser[] = "test-user@gmail.com"; | 24 const char kTestOtherUser[] = "test-user@gmail.com"; |
| 25 | 25 |
| 26 const char kTestManagerPassword[] = "password"; | 26 const char kTestManagerPassword[] = "password"; |
| 27 const char kTestSupervisedUserDisplayName[] = "John Doe"; | 27 const char kTestSupervisedUserDisplayName[] = "John Doe"; |
| 28 const char kTestSupervisedUserPassword[] = "simplepassword"; | 28 const char kTestSupervisedUserPassword[] = "simplepassword"; |
| 29 | 29 |
| 30 class ManagedUsersSyncTestAdapter { | 30 class SupervisedUsersSyncTestAdapter { |
| 31 public: | 31 public: |
| 32 explicit ManagedUsersSyncTestAdapter(Profile* profile); | 32 explicit SupervisedUsersSyncTestAdapter(Profile* profile); |
| 33 | 33 |
| 34 bool HasChanges() { return !processor_->changes().empty(); } | 34 bool HasChanges() { return !processor_->changes().empty(); } |
| 35 | 35 |
| 36 scoped_ptr< ::sync_pb::ManagedUserSpecifics> GetFirstChange(); | 36 scoped_ptr< ::sync_pb::ManagedUserSpecifics> GetFirstChange(); |
| 37 | 37 |
| 38 void AddChange(const ::sync_pb::ManagedUserSpecifics& proto, bool update); | 38 void AddChange(const ::sync_pb::ManagedUserSpecifics& proto, bool update); |
| 39 | 39 |
| 40 syncer::FakeSyncChangeProcessor* processor_; | 40 syncer::FakeSyncChangeProcessor* processor_; |
| 41 SupervisedUserSyncService* service_; | 41 SupervisedUserSyncService* service_; |
| 42 int next_sync_data_id_; | 42 int next_sync_data_id_; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 class ManagedUsersSharedSettingsSyncTestAdapter { | 45 class SupervisedUsersSharedSettingsSyncTestAdapter { |
| 46 public: | 46 public: |
| 47 explicit ManagedUsersSharedSettingsSyncTestAdapter(Profile* profile); | 47 explicit SupervisedUsersSharedSettingsSyncTestAdapter(Profile* profile); |
| 48 | 48 |
| 49 bool HasChanges() { return !processor_->changes().empty(); } | 49 bool HasChanges() { return !processor_->changes().empty(); } |
| 50 | 50 |
| 51 scoped_ptr< ::sync_pb::ManagedUserSharedSettingSpecifics> GetFirstChange(); | 51 scoped_ptr< ::sync_pb::ManagedUserSharedSettingSpecifics> GetFirstChange(); |
| 52 | 52 |
| 53 void AddChange(const ::sync_pb::ManagedUserSharedSettingSpecifics& proto, | 53 void AddChange(const ::sync_pb::ManagedUserSharedSettingSpecifics& proto, |
| 54 bool update); | 54 bool update); |
| 55 | 55 |
| 56 void AddChange(const std::string& mu_id, | 56 void AddChange(const std::string& mu_id, |
| 57 const std::string& key, | 57 const std::string& key, |
| 58 const base::Value& value, | 58 const base::Value& value, |
| 59 bool acknowledged, | 59 bool acknowledged, |
| 60 bool update); | 60 bool update); |
| 61 | 61 |
| 62 syncer::FakeSyncChangeProcessor* processor_; | 62 syncer::FakeSyncChangeProcessor* processor_; |
| 63 SupervisedUserSharedSettingsService* service_; | 63 SupervisedUserSharedSettingsService* service_; |
| 64 int next_sync_data_id_; | 64 int next_sync_data_id_; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 class ManagedUserTestBase : public chromeos::LoginManagerTest { | 67 class SupervisedUserTestBase : public chromeos::LoginManagerTest { |
| 68 public: | 68 public: |
| 69 ManagedUserTestBase(); | 69 SupervisedUserTestBase(); |
| 70 virtual ~ManagedUserTestBase(); | 70 virtual ~SupervisedUserTestBase(); |
| 71 | 71 |
| 72 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; | 72 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; |
| 73 virtual void CleanUpOnMainThread() OVERRIDE; | 73 virtual void CleanUpOnMainThread() OVERRIDE; |
| 74 | 74 |
| 75 protected: | 75 protected: |
| 76 virtual void TearDown() OVERRIDE; | 76 virtual void TearDown() OVERRIDE; |
| 77 | 77 |
| 78 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; | 78 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; |
| 79 | 79 |
| 80 void JSEval(const std::string& script); | 80 void JSEval(const std::string& script); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 95 void SigninAsManager(int user_index); | 95 void SigninAsManager(int user_index); |
| 96 void RemoveSupervisedUser(unsigned long original_user_count, | 96 void RemoveSupervisedUser(unsigned long original_user_count, |
| 97 int user_index, | 97 int user_index, |
| 98 const std::string& expected_display_name); | 98 const std::string& expected_display_name); |
| 99 | 99 |
| 100 cryptohome::MockAsyncMethodCaller* mock_async_method_caller_; | 100 cryptohome::MockAsyncMethodCaller* mock_async_method_caller_; |
| 101 cryptohome::MockHomedirMethods* mock_homedir_methods_; | 101 cryptohome::MockHomedirMethods* mock_homedir_methods_; |
| 102 NetworkPortalDetectorTestImpl* network_portal_detector_; | 102 NetworkPortalDetectorTestImpl* network_portal_detector_; |
| 103 SupervisedUserRegistrationUtilityStub* registration_utility_stub_; | 103 SupervisedUserRegistrationUtilityStub* registration_utility_stub_; |
| 104 scoped_ptr<ScopedTestingSupervisedUserRegistrationUtility> scoped_utility_; | 104 scoped_ptr<ScopedTestingSupervisedUserRegistrationUtility> scoped_utility_; |
| 105 scoped_ptr<ManagedUsersSharedSettingsSyncTestAdapter> | 105 scoped_ptr<SupervisedUsersSharedSettingsSyncTestAdapter> |
| 106 shared_settings_adapter_; | 106 shared_settings_adapter_; |
| 107 scoped_ptr<ManagedUsersSyncTestAdapter> managed_users_adapter_; | 107 scoped_ptr<SupervisedUsersSyncTestAdapter> supervised_users_adapter_; |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 DISALLOW_COPY_AND_ASSIGN(ManagedUserTestBase); | 110 DISALLOW_COPY_AND_ASSIGN(SupervisedUserTestBase); |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 } // namespace chromeos | 113 } // namespace chromeos |
| 114 | 114 |
| 115 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_MANAGED_USER_TEST_BASE_H_ | 115 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_TEST_BASE_H_ |
| OLD | NEW |