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

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

Issue 83633004: Do not spawn a thread in browser/interactive ui tests before spawning sandbox host process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 "ash/desktop_background/desktop_background_controller.h" 8 #include "ash/desktop_background/desktop_background_controller.h"
9 #include "ash/desktop_background/desktop_background_controller_observer.h" 9 #include "ash/desktop_background/desktop_background_controller_observer.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 virtual ~KioskTest() {} 242 virtual ~KioskTest() {}
243 243
244 protected: 244 protected:
245 virtual void SetUp() OVERRIDE { 245 virtual void SetUp() OVERRIDE {
246 base::FilePath test_data_dir; 246 base::FilePath test_data_dir;
247 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); 247 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
248 embedded_test_server()->ServeFilesFromDirectory(test_data_dir); 248 embedded_test_server()->ServeFilesFromDirectory(test_data_dir);
249 embedded_test_server()->RegisterRequestHandler( 249 embedded_test_server()->RegisterRequestHandler(
250 base::Bind(&FakeGaia::HandleRequest, base::Unretained(&fake_gaia_))); 250 base::Bind(&FakeGaia::HandleRequest, base::Unretained(&fake_gaia_)));
251 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 251 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
252 // Stop IO thread here because no threads are allowed while
253 // spawning sandbox host process. See crbug.com/322732.
254 embedded_test_server()->StopThread();
252 255
253 mock_user_manager_.reset(new MockUserManager); 256 mock_user_manager_.reset(new MockUserManager);
254 AppLaunchController::SkipSplashWaitForTesting(); 257 AppLaunchController::SkipSplashWaitForTesting();
255 AppLaunchController::SetNetworkWaitForTesting(kTestNetworkTimeoutSeconds); 258 AppLaunchController::SetNetworkWaitForTesting(kTestNetworkTimeoutSeconds);
256 259
257 InProcessBrowserTest::SetUp(); 260 InProcessBrowserTest::SetUp();
258 } 261 }
259 262
260 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 263 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
261 host_resolver()->AddRule("*", "127.0.0.1"); 264 host_resolver()->AddRule("*", "127.0.0.1");
262 } 265 }
263 266
267 virtual void SetUpOnMainThread() OVERRIDE {
268 // Restart the thread as the sandbox host process has already been spawned.
269 embedded_test_server()->RestartThreadAndListen();
270 }
271
264 virtual void CleanUpOnMainThread() OVERRIDE { 272 virtual void CleanUpOnMainThread() OVERRIDE {
265 // We need to clean up these objects in this specific order. 273 // We need to clean up these objects in this specific order.
266 fake_network_notifier_.reset(NULL); 274 fake_network_notifier_.reset(NULL);
267 disable_network_notifier_.reset(NULL); 275 disable_network_notifier_.reset(NULL);
268 276
269 AppLaunchController::SetNetworkTimeoutCallbackForTesting(NULL); 277 AppLaunchController::SetNetworkTimeoutCallbackForTesting(NULL);
270 AppLaunchSigninScreen::SetUserManagerForTesting(NULL); 278 AppLaunchSigninScreen::SetUserManagerForTesting(NULL);
271 279
272 // If the login display is still showing, exit gracefully. 280 // If the login display is still showing, exit gracefully.
273 if (LoginDisplayHostImpl::default_host()) { 281 if (LoginDisplayHostImpl::default_host()) {
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 KioskEnterpriseTest() {} 802 KioskEnterpriseTest() {}
795 803
796 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 804 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
797 device_policy_test_helper_.MarkAsEnterpriseOwned(); 805 device_policy_test_helper_.MarkAsEnterpriseOwned();
798 device_policy_test_helper_.InstallOwnerKey(); 806 device_policy_test_helper_.InstallOwnerKey();
799 807
800 KioskTest::SetUpInProcessBrowserTestFixture(); 808 KioskTest::SetUpInProcessBrowserTestFixture();
801 } 809 }
802 810
803 virtual void SetUpOnMainThread() OVERRIDE { 811 virtual void SetUpOnMainThread() OVERRIDE {
812 KioskTest::SetUpOnMainThread();
804 // Configure kTestEnterpriseKioskApp in device policy. 813 // Configure kTestEnterpriseKioskApp in device policy.
805 em::DeviceLocalAccountsProto* accounts = 814 em::DeviceLocalAccountsProto* accounts =
806 device_policy_test_helper_.device_policy()->payload() 815 device_policy_test_helper_.device_policy()->payload()
807 .mutable_device_local_accounts(); 816 .mutable_device_local_accounts();
808 em::DeviceLocalAccountInfoProto* account = accounts->add_account(); 817 em::DeviceLocalAccountInfoProto* account = accounts->add_account();
809 account->set_account_id(kTestEnterpriseAccountId); 818 account->set_account_id(kTestEnterpriseAccountId);
810 account->set_type( 819 account->set_type(
811 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_KIOSK_APP); 820 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_KIOSK_APP);
812 account->mutable_kiosk_app()->set_app_id(kTestEnterpriseKioskApp); 821 account->mutable_kiosk_app()->set_app_id(kTestEnterpriseKioskApp);
813 accounts->set_auto_login_id(kTestEnterpriseAccountId); 822 accounts->set_auto_login_id(kTestEnterpriseAccountId);
(...skipping 11 matching lines...) Expand all
825 FakeGaia::AccessTokenInfo token_info; 834 FakeGaia::AccessTokenInfo token_info;
826 token_info.token = kTestAccessToken; 835 token_info.token = kTestAccessToken;
827 token_info.email = kTestEnterpriseServiceAccountId; 836 token_info.email = kTestEnterpriseServiceAccountId;
828 fake_gaia_.IssueOAuthToken(kTestRefreshToken, token_info); 837 fake_gaia_.IssueOAuthToken(kTestRefreshToken, token_info);
829 DeviceOAuth2TokenService* token_service = NULL; 838 DeviceOAuth2TokenService* token_service = NULL;
830 DeviceOAuth2TokenServiceFactory::Get( 839 DeviceOAuth2TokenServiceFactory::Get(
831 base::Bind(&CopyTokenService, &token_service)); 840 base::Bind(&CopyTokenService, &token_service));
832 base::RunLoop().RunUntilIdle(); 841 base::RunLoop().RunUntilIdle();
833 ASSERT_TRUE(token_service); 842 ASSERT_TRUE(token_service);
834 token_service->SetAndSaveRefreshToken(kTestRefreshToken); 843 token_service->SetAndSaveRefreshToken(kTestRefreshToken);
835
836 KioskTest::SetUpOnMainThread();
837 } 844 }
838 845
839 static void StorePolicyCallback(bool result) { 846 static void StorePolicyCallback(bool result) {
840 ASSERT_TRUE(result); 847 ASSERT_TRUE(result);
841 } 848 }
842 849
843 policy::DevicePolicyCrosTestHelper device_policy_test_helper_; 850 policy::DevicePolicyCrosTestHelper device_policy_test_helper_;
844 851
845 private: 852 private:
846 DISALLOW_COPY_AND_ASSIGN(KioskEnterpriseTest); 853 DISALLOW_COPY_AND_ASSIGN(KioskEnterpriseTest);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 content::WindowedNotificationObserver( 973 content::WindowedNotificationObserver(
967 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, 974 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE,
968 content::NotificationService::AllSources()).Wait(); 975 content::NotificationService::AllSources()).Wait();
969 976
970 // Wait for the wallpaper to load. 977 // Wait for the wallpaper to load.
971 WaitForWallpaper(); 978 WaitForWallpaper();
972 EXPECT_TRUE(wallpaper_loaded()); 979 EXPECT_TRUE(wallpaper_loaded());
973 } 980 }
974 981
975 } // namespace chromeos 982 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698