Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: chrome/browser/chromeos/login/kiosk_browsertest.cc

Issue 34523003: settings: Make DeviceOAuth2TokenServiceFactory::Get() async (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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();
hashimoto 2013/10/22 08:49:51 nit: How about having ASSERT_TRUE(token_service) h
satorux1 2013/10/22 09:56:43 good idea. will do.
satorux1 2013/10/23 06:35:44 Done.
711 token_service->SetAndSaveRefreshToken(kTestRefreshToken);
703 712
704 KioskTest::SetUpOnMainThread(); 713 KioskTest::SetUpOnMainThread();
705 } 714 }
706 715
707 static void StorePolicyCallback(bool result) { 716 static void StorePolicyCallback(bool result) {
708 ASSERT_TRUE(result); 717 ASSERT_TRUE(result);
709 } 718 }
710 719
711 policy::DevicePolicyCrosTestHelper device_policy_test_helper_; 720 policy::DevicePolicyCrosTestHelper device_policy_test_helper_;
712 721
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 window->GetBaseWindow()->Close(); 770 window->GetBaseWindow()->Close();
762 content::RunAllPendingInMessageLoop(); 771 content::RunAllPendingInMessageLoop();
763 } 772 }
764 773
765 // Disabled due to failures; http://crbug.com/306611. 774 // Disabled due to failures; http://crbug.com/306611.
766 INSTANTIATE_TEST_CASE_P(DISABLED_KioskEnterpriseTestInstantiation, 775 INSTANTIATE_TEST_CASE_P(DISABLED_KioskEnterpriseTestInstantiation,
767 KioskEnterpriseTest, 776 KioskEnterpriseTest,
768 testing::Bool()); 777 testing::Bool());
769 778
770 } // namespace chromeos 779 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698