| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "apps/shell_window.h" | 5 #include "apps/shell_window.h" |
| 6 #include "apps/shell_window_registry.h" | 6 #include "apps/shell_window_registry.h" |
| 7 #include "apps/ui/native_app_window.h" | 7 #include "apps/ui/native_app_window.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 LOG(INFO) << "kiosk locked = " << in_locked; | 110 LOG(INFO) << "kiosk locked = " << in_locked; |
| 111 *out_locked = in_locked; | 111 *out_locked = in_locked; |
| 112 runner_quit_task.Run(); | 112 runner_quit_task.Run(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 // Helper function for WaitForNetworkTimeOut. | 115 // Helper function for WaitForNetworkTimeOut. |
| 116 void OnNetworkWaitTimedOut(const base::Closure& runner_quit_task) { | 116 void OnNetworkWaitTimedOut(const base::Closure& runner_quit_task) { |
| 117 runner_quit_task.Run(); | 117 runner_quit_task.Run(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Helper function for DeviceOAuth2TokenServiceFactory::Get(). |
| 121 void CopyTokenService(DeviceOAuth2TokenService** out_token_service, |
| 122 DeviceOAuth2TokenService* in_token_service) { |
| 123 *out_token_service = in_token_service; |
| 124 } |
| 125 |
| 120 } // namespace | 126 } // namespace |
| 121 | 127 |
| 122 // Fake NetworkChangeNotifier used to simulate network connectivity. | 128 // Fake NetworkChangeNotifier used to simulate network connectivity. |
| 123 class FakeNetworkChangeNotifier : public net::NetworkChangeNotifier { | 129 class FakeNetworkChangeNotifier : public net::NetworkChangeNotifier { |
| 124 public: | 130 public: |
| 125 FakeNetworkChangeNotifier() : connection_type_(CONNECTION_NONE) {} | 131 FakeNetworkChangeNotifier() : connection_type_(CONNECTION_NONE) {} |
| 126 | 132 |
| 127 virtual ConnectionType GetCurrentConnectionType() const OVERRIDE { | 133 virtual ConnectionType GetCurrentConnectionType() const OVERRIDE { |
| 128 return connection_type_; | 134 return connection_type_; |
| 129 } | 135 } |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 device_policy_test_helper_.device_policy()->GetBlob(), | 697 device_policy_test_helper_.device_policy()->GetBlob(), |
| 692 base::Bind(&KioskEnterpriseTest::StorePolicyCallback)); | 698 base::Bind(&KioskEnterpriseTest::StorePolicyCallback)); |
| 693 | 699 |
| 694 DeviceSettingsService::Get()->Load(); | 700 DeviceSettingsService::Get()->Load(); |
| 695 | 701 |
| 696 // Configure OAuth authentication. | 702 // Configure OAuth authentication. |
| 697 FakeGaia::AccessTokenInfo token_info; | 703 FakeGaia::AccessTokenInfo token_info; |
| 698 token_info.token = kTestAccessToken; | 704 token_info.token = kTestAccessToken; |
| 699 token_info.email = kTestEnterpriseServiceAccountId; | 705 token_info.email = kTestEnterpriseServiceAccountId; |
| 700 fake_gaia_.IssueOAuthToken(kTestRefreshToken, token_info); | 706 fake_gaia_.IssueOAuthToken(kTestRefreshToken, token_info); |
| 701 DeviceOAuth2TokenServiceFactory::Get() | 707 DeviceOAuth2TokenService* token_service = NULL; |
| 702 ->SetAndSaveRefreshToken(kTestRefreshToken); | 708 DeviceOAuth2TokenServiceFactory::Get( |
| 709 base::Bind(&CopyTokenService, &token_service)); |
| 710 base::RunLoop().RunUntilIdle(); |
| 711 ASSERT_TRUE(token_service); |
| 712 token_service->SetAndSaveRefreshToken(kTestRefreshToken); |
| 703 | 713 |
| 704 KioskTest::SetUpOnMainThread(); | 714 KioskTest::SetUpOnMainThread(); |
| 705 } | 715 } |
| 706 | 716 |
| 707 static void StorePolicyCallback(bool result) { | 717 static void StorePolicyCallback(bool result) { |
| 708 ASSERT_TRUE(result); | 718 ASSERT_TRUE(result); |
| 709 } | 719 } |
| 710 | 720 |
| 711 policy::DevicePolicyCrosTestHelper device_policy_test_helper_; | 721 policy::DevicePolicyCrosTestHelper device_policy_test_helper_; |
| 712 | 722 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 window->GetBaseWindow()->Close(); | 771 window->GetBaseWindow()->Close(); |
| 762 content::RunAllPendingInMessageLoop(); | 772 content::RunAllPendingInMessageLoop(); |
| 763 } | 773 } |
| 764 | 774 |
| 765 // Disabled due to failures; http://crbug.com/306611. | 775 // Disabled due to failures; http://crbug.com/306611. |
| 766 INSTANTIATE_TEST_CASE_P(DISABLED_KioskEnterpriseTestInstantiation, | 776 INSTANTIATE_TEST_CASE_P(DISABLED_KioskEnterpriseTestInstantiation, |
| 767 KioskEnterpriseTest, | 777 KioskEnterpriseTest, |
| 768 testing::Bool()); | 778 testing::Bool()); |
| 769 | 779 |
| 770 } // namespace chromeos | 780 } // namespace chromeos |
| OLD | NEW |