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 #include "chrome/test/testing_device_token_fetcher.h" |
| 6 |
| 7 #include "chrome/common/notification_service.h" |
| 8 #include "chrome/common/notification_source.h" |
| 9 #include "chrome/common/notification_type.h" |
| 10 #include "chrome/browser/policy/device_token_fetcher.h" |
| 11 #include "chrome/browser/profile.h" |
| 12 |
| 13 #if defined(OS_CHROMEOS) |
| 14 #include "chrome/browser/chromeos/login/user_manager.h" |
| 15 #else |
| 16 #include "chrome/browser/sync/signin_manager.h" |
| 17 #endif |
| 18 |
| 19 namespace policy { |
| 20 |
| 21 const char* kTestManagedDomainUsername = "___@example.com"; |
| 22 |
| 23 void TestingDeviceTokenFetcher::SimulateLogin(const std::string& username) { |
| 24 username_ = username; |
| 25 #if defined(OS_CHROMEOS) |
| 26 chromeos::UserManager::User user; |
| 27 user.set_email(username_); |
| 28 NotificationService::current()->Notify( |
| 29 NotificationType::LOGIN_USER_CHANGED, |
| 30 Source<chromeos::UserManager>(NULL), |
| 31 Details<const chromeos::UserManager::User>(&user)); |
| 32 #else |
| 33 GoogleServiceSigninSuccessDetails details(username_, ""); |
| 34 NotificationService::current()->Notify( |
| 35 NotificationType::GOOGLE_SIGNIN_SUCCESSFUL, |
| 36 Source<Profile>(profile_), |
| 37 Details<const GoogleServiceSigninSuccessDetails>(&details)); |
| 38 #endif |
| 39 } |
| 40 |
| 41 std::string TestingDeviceTokenFetcher::GetCurrentUser() { |
| 42 return username_; |
| 43 } |
| 44 |
| 45 } // namespace policy |
OLD | NEW |