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

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

Issue 11991002: Merge 176800 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1364/src/
Patch Set: Created 7 years, 11 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) 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 "chrome/browser/chromeos/login/login_utils.h" 5 #include "chrome/browser/chromeos/login/login_utils.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
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/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // Map BrowserThread::IO to this loop. This allows posting to IO but nothing 175 // Map BrowserThread::IO to this loop. This allows posting to IO but nothing
176 // will be executed. 176 // will be executed.
177 io_thread_.reset( 177 io_thread_.reset(
178 new content::TestBrowserThread(BrowserThread::IO, fake_io_loop)); 178 new content::TestBrowserThread(BrowserThread::IO, fake_io_loop));
179 179
180 ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); 180 ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir());
181 181
182 CommandLine* command_line = CommandLine::ForCurrentProcess(); 182 CommandLine* command_line = CommandLine::ForCurrentProcess();
183 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, kDMServer); 183 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, kDMServer);
184 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); 184 command_line->AppendSwitchASCII(switches::kLoginProfile, "user");
185 // TODO(mnissler): Figure out how to beat this test into submission on
186 // OAuth2 path.
187 command_line->AppendSwitch(switches::kForceOAuth1);
185 188
186 local_state_.Get()->RegisterStringPref(prefs::kApplicationLocale, ""); 189 local_state_.Get()->RegisterStringPref(prefs::kApplicationLocale, "");
187 190
188 // DBusThreadManager should be initialized before io_thread_state_, as 191 // DBusThreadManager should be initialized before io_thread_state_, as
189 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl, 192 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl,
190 // which is part of io_thread_state_. 193 // which is part of io_thread_state_.
191 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); 194 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_);
192 195
193 input_method::InitializeForTesting( 196 input_method::InitializeForTesting(
194 &mock_input_method_manager_); 197 &mock_input_method_manager_);
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 .WillRepeatedly(Return(std::string("stub_system_salt"))); 398 .WillRepeatedly(Return(std::string("stub_system_salt")));
396 EXPECT_CALL(*mock_async_method_caller_, AsyncMount(_, _, _, _)) 399 EXPECT_CALL(*mock_async_method_caller_, AsyncMount(_, _, _, _))
397 .WillRepeatedly(Return()); 400 .WillRepeatedly(Return());
398 401
399 scoped_refptr<Authenticator> authenticator = 402 scoped_refptr<Authenticator> authenticator =
400 LoginUtils::Get()->CreateAuthenticator(this); 403 LoginUtils::Get()->CreateAuthenticator(this);
401 authenticator->CompleteLogin(ProfileManager::GetDefaultProfile(), 404 authenticator->CompleteLogin(ProfileManager::GetDefaultProfile(),
402 username, 405 username,
403 "password"); 406 "password");
404 407
405 const bool kPendingRequests = false;
406 const bool kUsingOAuth = true; 408 const bool kUsingOAuth = true;
407 const bool kHasCookies = true; 409 const bool kHasCookies = true;
408 LoginUtils::Get()->PrepareProfile(username, std::string(), "password", 410 LoginUtils::Get()->PrepareProfile(username, std::string(), "password",
409 kPendingRequests, kUsingOAuth, 411 kUsingOAuth, kHasCookies, this);
410 kHasCookies, this);
411 device_settings_test_helper.Flush(); 412 device_settings_test_helper.Flush();
412 RunUntilIdle(); 413 RunUntilIdle();
413 } 414 }
414 415
415 net::TestURLFetcher* PrepareOAuthFetcher(const std::string& expected_url) { 416 net::TestURLFetcher* PrepareOAuthFetcher(const std::string& expected_url) {
416 net::TestURLFetcher* fetcher = test_url_fetcher_factory_.GetFetcherByID(0); 417 net::TestURLFetcher* fetcher = test_url_fetcher_factory_.GetFetcherByID(0);
417 EXPECT_TRUE(fetcher); 418 EXPECT_TRUE(fetcher);
418 EXPECT_TRUE(fetcher->delegate()); 419 EXPECT_TRUE(fetcher->delegate());
419 EXPECT_TRUE(StartsWithASCII(fetcher->GetOriginalURL().spec(), 420 EXPECT_TRUE(StartsWithASCII(fetcher->GetOriginalURL().spec(),
420 expected_url, 421 expected_url,
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 } 677 }
677 678
678 INSTANTIATE_TEST_CASE_P( 679 INSTANTIATE_TEST_CASE_P(
679 LoginUtilsBlockingLoginTestInstance, 680 LoginUtilsBlockingLoginTestInstance,
680 LoginUtilsBlockingLoginTest, 681 LoginUtilsBlockingLoginTest,
681 testing::Values(0, 1, 2, 3, 4, 5)); 682 testing::Values(0, 1, 2, 3, 4, 5));
682 683
683 } // namespace 684 } // namespace
684 685
685 } 686 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_utils.cc ('k') | chrome/browser/chromeos/login/mock_login_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698