Chromium Code Reviews| Index: chrome/test/testing_device_token_fetcher.h |
| diff --git a/chrome/test/testing_device_token_fetcher.h b/chrome/test/testing_device_token_fetcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..599d1f4ff8d2a92fbd642ba26fcee521fb547ca2 |
| --- /dev/null |
| +++ b/chrome/test/testing_device_token_fetcher.h |
| @@ -0,0 +1,47 @@ |
| +// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_TEST_TESTING_DEVICE_TOKEN_FETCHER_H_ |
| +#define CHROME_TEST_TESTING_DEVICE_TOKEN_FETCHER_H_ |
| +#pragma once |
| + |
| +#include <string> |
| + |
| +#include "chrome/browser/policy/device_token_fetcher.h" |
| + |
| +class DeviceTokenService; |
| +class Profile; |
| + |
| +namespace policy { |
| + |
| +extern const char* kTestDasherDomainUsername; |
| + |
| +// Replacement for DeviceTokenFetcher in tests. The only difference in internal |
| +// logic is that the name of the currently logged in user is not fetched from |
| +// external objects, but stored internally. |
| +class TestingDeviceTokenFetcher |
| + : public DeviceTokenFetcher { |
| + public: |
| + TestingDeviceTokenFetcher( |
| + DeviceManagementBackend* backend, |
| + Profile* profile, |
| + const FilePath& token_path) : |
| + DeviceTokenFetcher(backend, profile, token_path) {} |
| + virtual void SimulateLogin(const std::string& username); |
|
Mattias Nissler (ping if slow)
2010/11/22 20:36:08
Why is this virtual?
gfeher
2010/11/23 13:47:51
Memories of Java...
|
| + |
| + protected: |
| + virtual std::string GetCurrentUser() { |
| + return username_; |
| + } |
| + |
| + private: |
| + // This username will be reported as currently logged in. |
| + std::string username_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TestingDeviceTokenFetcher); |
| +}; |
| + |
| +} // namespace policy |
| + |
| +#endif // CHROME_TEST_TESTING_DEVICE_TOKEN_FETCHER_H_ |