| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "chromeos/dbus/mock_update_engine_client.h" | 48 #include "chromeos/dbus/mock_update_engine_client.h" |
| 49 #include "content/public/browser/notification_details.h" | 49 #include "content/public/browser/notification_details.h" |
| 50 #include "content/public/browser/notification_service.h" | 50 #include "content/public/browser/notification_service.h" |
| 51 #include "content/public/test/mock_notification_observer.h" | 51 #include "content/public/test/mock_notification_observer.h" |
| 52 #include "google_apis/gaia/mock_url_fetcher_factory.h" | 52 #include "google_apis/gaia/mock_url_fetcher_factory.h" |
| 53 #include "grit/generated_resources.h" | 53 #include "grit/generated_resources.h" |
| 54 #include "testing/gmock/include/gmock/gmock.h" | 54 #include "testing/gmock/include/gmock/gmock.h" |
| 55 #include "testing/gtest/include/gtest/gtest.h" | 55 #include "testing/gtest/include/gtest/gtest.h" |
| 56 #include "ui/base/l10n/l10n_util.h" | 56 #include "ui/base/l10n/l10n_util.h" |
| 57 | 57 |
| 58 using ::testing::_; | |
| 59 using ::testing::AnyNumber; | 58 using ::testing::AnyNumber; |
| 60 using ::testing::Invoke; | 59 using ::testing::Invoke; |
| 61 using ::testing::InvokeWithoutArgs; | 60 using ::testing::InvokeWithoutArgs; |
| 62 using ::testing::Return; | 61 using ::testing::Return; |
| 63 using ::testing::ReturnNull; | 62 using ::testing::ReturnNull; |
| 64 using ::testing::Sequence; | 63 using ::testing::Sequence; |
| 65 using ::testing::WithArg; | 64 using ::testing::WithArg; |
| 65 using ::testing::_; |
| 66 | 66 |
| 67 namespace em = enterprise_management; | 67 namespace em = enterprise_management; |
| 68 | 68 |
| 69 namespace chromeos { | 69 namespace chromeos { |
| 70 | 70 |
| 71 namespace { | 71 namespace { |
| 72 | 72 |
| 73 const char kUsername[] = "test_user@gmail.com"; | 73 const char kUsername[] = "test_user@gmail.com"; |
| 74 const char kNewUsername[] = "test_new_user@gmail.com"; | 74 const char kNewUsername[] = "test_new_user@gmail.com"; |
| 75 const char kPassword[] = "test_password"; | 75 const char kPassword[] = "test_password"; |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 loop.Run(); | 462 loop.Run(); |
| 463 store->RemoveObserver(&observer); | 463 store->RemoveObserver(&observer); |
| 464 } | 464 } |
| 465 } | 465 } |
| 466 | 466 |
| 467 virtual void SetUpSessionManager() OVERRIDE { | 467 virtual void SetUpSessionManager() OVERRIDE { |
| 468 InstallOwnerKey(); | 468 InstallOwnerKey(); |
| 469 | 469 |
| 470 // Setup the device policy. | 470 // Setup the device policy. |
| 471 em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); | 471 em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); |
| 472 proto.mutable_device_local_accounts()->add_account()->set_id( | 472 em::DeviceLocalAccountInfoProto* account = |
| 473 kAutoLoginUsername); | 473 proto.mutable_device_local_accounts()->add_account(); |
| 474 account->set_account_id(kAutoLoginUsername); |
| 475 account->set_type( |
| 476 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_PUBLIC_SESSION); |
| 474 RefreshDevicePolicy(); | 477 RefreshDevicePolicy(); |
| 475 | 478 |
| 476 // Setup the device local account policy. | 479 // Setup the device local account policy. |
| 477 policy::UserPolicyBuilder device_local_account_policy; | 480 policy::UserPolicyBuilder device_local_account_policy; |
| 478 device_local_account_policy.policy_data().set_username(kAutoLoginUsername); | 481 device_local_account_policy.policy_data().set_username(kAutoLoginUsername); |
| 479 device_local_account_policy.policy_data().set_policy_type( | 482 device_local_account_policy.policy_data().set_policy_type( |
| 480 policy::dm_protocol::kChromePublicAccountPolicyType); | 483 policy::dm_protocol::kChromePublicAccountPolicyType); |
| 481 device_local_account_policy.policy_data().set_settings_entity_id( | 484 device_local_account_policy.policy_data().set_settings_entity_id( |
| 482 kAutoLoginUsername); | 485 kAutoLoginUsername); |
| 483 device_local_account_policy.Build(); | 486 device_local_account_policy.Build(); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 | 755 |
| 753 // Wait for login tasks to complete. | 756 // Wait for login tasks to complete. |
| 754 content::RunAllPendingInMessageLoop(); | 757 content::RunAllPendingInMessageLoop(); |
| 755 | 758 |
| 756 // Timer should still be stopped after login completes. | 759 // Timer should still be stopped after login completes. |
| 757 ASSERT_TRUE(auto_login_timer()); | 760 ASSERT_TRUE(auto_login_timer()); |
| 758 EXPECT_FALSE(auto_login_timer()->IsRunning()); | 761 EXPECT_FALSE(auto_login_timer()->IsRunning()); |
| 759 } | 762 } |
| 760 | 763 |
| 761 } // namespace chromeos | 764 } // namespace chromeos |
| OLD | NEW |