| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_TEST_TESTING_DEVICE_TOKEN_FETCHER_H_ | |
| 6 #define CHROME_TEST_TESTING_DEVICE_TOKEN_FETCHER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "chrome/browser/policy/device_token_fetcher.h" | |
| 12 | |
| 13 class DeviceTokenService; | |
| 14 class Profile; | |
| 15 | |
| 16 namespace policy { | |
| 17 | |
| 18 extern const char* kTestManagedDomainUsername; | |
| 19 | |
| 20 // Replacement for DeviceTokenFetcher in tests. The only difference in internal | |
| 21 // logic is that the name of the currently logged in user is not fetched from | |
| 22 // external objects, but stored internally. | |
| 23 class TestingDeviceTokenFetcher | |
| 24 : public DeviceTokenFetcher { | |
| 25 public: | |
| 26 TestingDeviceTokenFetcher( | |
| 27 DeviceManagementBackend* backend, | |
| 28 Profile* profile, | |
| 29 const FilePath& token_path) | |
| 30 : DeviceTokenFetcher(backend, profile, token_path) {} | |
| 31 | |
| 32 void SimulateLogin(const std::string& username); | |
| 33 | |
| 34 protected: | |
| 35 virtual std::string GetCurrentUser(); | |
| 36 | |
| 37 private: | |
| 38 // This username will be reported as currently logged in. | |
| 39 std::string username_; | |
| 40 | |
| 41 DISALLOW_COPY_AND_ASSIGN(TestingDeviceTokenFetcher); | |
| 42 }; | |
| 43 | |
| 44 } // namespace policy | |
| 45 | |
| 46 #endif // CHROME_TEST_TESTING_DEVICE_TOKEN_FETCHER_H_ | |
| OLD | NEW |