| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 | 4 |
| 5 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 11 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| 12 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
| 13 #include "components/user_manager/user.h" | 12 #include "components/user_manager/user.h" |
| 13 #include "components/user_manager/user_manager.h" |
| 14 #include "extensions/common/switches.h" | 14 #include "extensions/common/switches.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 16 | 16 |
| 17 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
| 18 #include "chrome/browser/chromeos/login/helper.h" | 18 #include "chrome/browser/chromeos/login/helper.h" |
| 19 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" | 19 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" |
| 20 #include "chromeos/chromeos_switches.h" | 20 #include "chromeos/chromeos_switches.h" |
| 21 #include "chromeos/dbus/cryptohome_client.h" | 21 #include "chromeos/dbus/cryptohome_client.h" |
| 22 #include "chromeos/dbus/dbus_thread_manager.h" | 22 #include "chromeos/dbus/dbus_thread_manager.h" |
| 23 #include "chromeos/dbus/shill_device_client.h" | 23 #include "chromeos/dbus/shill_device_client.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // uses the ProfileHelper to obtain the userhash crbug/238623. | 181 // uses the ProfileHelper to obtain the userhash crbug/238623. |
| 182 const std::string login_user = chromeos::login::CanonicalizeUserID( | 182 const std::string login_user = chromeos::login::CanonicalizeUserID( |
| 183 command_line->GetSwitchValueNative(chromeos::switches::kLoginUser)); | 183 command_line->GetSwitchValueNative(chromeos::switches::kLoginUser)); |
| 184 const std::string sanitized_user = | 184 const std::string sanitized_user = |
| 185 CryptohomeClient::GetStubSanitizedUsername(login_user); | 185 CryptohomeClient::GetStubSanitizedUsername(login_user); |
| 186 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, | 186 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, |
| 187 sanitized_user); | 187 sanitized_user); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void InitializeSanitizedUsername() { | 190 void InitializeSanitizedUsername() { |
| 191 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | 191 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 192 user_manager::User* user = user_manager->GetActiveUser(); | 192 user_manager::User* user = user_manager->GetActiveUser(); |
| 193 CHECK(user); | 193 CHECK(user); |
| 194 std::string userhash; | 194 std::string userhash; |
| 195 DBusThreadManager::Get()->GetCryptohomeClient()->GetSanitizedUsername( | 195 DBusThreadManager::Get()->GetCryptohomeClient()->GetSanitizedUsername( |
| 196 user->email(), | 196 user->email(), |
| 197 base::Bind(&AssignString, &userhash_)); | 197 base::Bind(&AssignString, &userhash_)); |
| 198 content::RunAllPendingInMessageLoop(); | 198 content::RunAllPendingInMessageLoop(); |
| 199 CHECK(!userhash_.empty()); | 199 CHECK(!userhash_.empty()); |
| 200 } | 200 } |
| 201 | 201 |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 611 |
| 612 TestListener listener( | 612 TestListener listener( |
| 613 "notifyPortalDetectorObservers", | 613 "notifyPortalDetectorObservers", |
| 614 base::Bind(&NetworkPortalDetectorTestImpl::NotifyObserversForTesting, | 614 base::Bind(&NetworkPortalDetectorTestImpl::NotifyObserversForTesting, |
| 615 base::Unretained(detector()))); | 615 base::Unretained(detector()))); |
| 616 EXPECT_TRUE(RunNetworkingSubtest("captivePortalNotification")) << message_; | 616 EXPECT_TRUE(RunNetworkingSubtest("captivePortalNotification")) << message_; |
| 617 } | 617 } |
| 618 #endif // defined(OS_CHROMEOS) | 618 #endif // defined(OS_CHROMEOS) |
| 619 | 619 |
| 620 } // namespace | 620 } // namespace |
| OLD | NEW |