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 | 4 |
5 #include <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 14 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
15 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 15 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
16 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
17 #include "chrome/browser/chromeos/login/wizard_controller.h" | 16 #include "chrome/browser/chromeos/login/wizard_controller.h" |
18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
19 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 18 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
20 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 19 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
21 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/test/base/in_process_browser_test.h" | 21 #include "chrome/test/base/in_process_browser_test.h" |
23 #include "chromeos/chromeos_switches.h" | 22 #include "chromeos/chromeos_switches.h" |
24 #include "components/policy/core/common/cloud/device_management_service.h" | 23 #include "components/policy/core/common/cloud/device_management_service.h" |
25 #include "components/policy/core/common/policy_switches.h" | 24 #include "components/policy/core/common/policy_switches.h" |
| 25 #include "components/user_manager/user_manager.h" |
26 #include "content/public/browser/notification_observer.h" | 26 #include "content/public/browser/notification_observer.h" |
27 #include "content/public/browser/notification_registrar.h" | 27 #include "content/public/browser/notification_registrar.h" |
28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
29 #include "content/public/test/test_utils.h" | 29 #include "content/public/test/test_utils.h" |
30 #include "google_apis/gaia/fake_gaia.h" | 30 #include "google_apis/gaia/fake_gaia.h" |
31 #include "google_apis/gaia/gaia_switches.h" | 31 #include "google_apis/gaia/gaia_switches.h" |
32 #include "google_apis/gaia/gaia_urls.h" | 32 #include "google_apis/gaia/gaia_urls.h" |
33 #include "net/http/http_status_code.h" | 33 #include "net/http/http_status_code.h" |
34 #include "net/test/embedded_test_server/embedded_test_server.h" | 34 #include "net/test/embedded_test_server/embedded_test_server.h" |
35 #include "net/test/embedded_test_server/http_request.h" | 35 #include "net/test/embedded_test_server/http_request.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 private: | 250 private: |
251 FakeGaia fake_gaia_; | 251 FakeGaia fake_gaia_; |
252 std::vector<net::test_server::HttpResponse*> responses_; | 252 std::vector<net::test_server::HttpResponse*> responses_; |
253 content::NotificationRegistrar registrar_; | 253 content::NotificationRegistrar registrar_; |
254 | 254 |
255 DISALLOW_COPY_AND_ASSIGN(BlockingLoginTest); | 255 DISALLOW_COPY_AND_ASSIGN(BlockingLoginTest); |
256 }; | 256 }; |
257 | 257 |
258 IN_PROC_BROWSER_TEST_P(BlockingLoginTest, LoginBlocksForUser) { | 258 IN_PROC_BROWSER_TEST_P(BlockingLoginTest, LoginBlocksForUser) { |
259 // Verify that there isn't a logged in user when the test starts. | 259 // Verify that there isn't a logged in user when the test starts. |
260 UserManager* user_manager = UserManager::Get(); | 260 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
261 EXPECT_FALSE(user_manager->IsUserLoggedIn()); | 261 EXPECT_FALSE(user_manager->IsUserLoggedIn()); |
262 EXPECT_FALSE(browser_policy_connector()->IsEnterpriseManaged()); | 262 EXPECT_FALSE(browser_policy_connector()->IsEnterpriseManaged()); |
263 EXPECT_FALSE(profile_added_); | 263 EXPECT_FALSE(profile_added_); |
264 | 264 |
265 // Enroll the device, if enrollment is enabled for this test instance. | 265 // Enroll the device, if enrollment is enabled for this test instance. |
266 if (GetParam().enroll_device) { | 266 if (GetParam().enroll_device) { |
267 EnrollDevice(kUsername); | 267 EnrollDevice(kUsername); |
268 | 268 |
269 EXPECT_FALSE(user_manager->IsUserLoggedIn()); | 269 EXPECT_FALSE(user_manager->IsUserLoggedIn()); |
270 EXPECT_TRUE(browser_policy_connector()->IsEnterpriseManaged()); | 270 EXPECT_TRUE(browser_policy_connector()->IsEnterpriseManaged()); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 { 3, kUsernameOtherDomain, true }, | 347 { 3, kUsernameOtherDomain, true }, |
348 { 4, kUsernameOtherDomain, true }, | 348 { 4, kUsernameOtherDomain, true }, |
349 { 5, kUsernameOtherDomain, true }, | 349 { 5, kUsernameOtherDomain, true }, |
350 }; | 350 }; |
351 | 351 |
352 INSTANTIATE_TEST_CASE_P(BlockingLoginTestInstance, | 352 INSTANTIATE_TEST_CASE_P(BlockingLoginTestInstance, |
353 BlockingLoginTest, | 353 BlockingLoginTest, |
354 testing::ValuesIn(kBlockinLoginTestCases)); | 354 testing::ValuesIn(kBlockinLoginTestCases)); |
355 | 355 |
356 } // namespace chromeos | 356 } // namespace chromeos |
OLD | NEW |