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

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

Issue 10918027: Revert 154457 - Switch from SignedSettings to DeviceSettingsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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/parallel_authenticator.h" 5 #include "chrome/browser/chromeos/login/parallel_authenticator.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "chrome/browser/chromeos/cros/cros_library.h" 15 #include "chrome/browser/chromeos/cros/cros_library.h"
16 #include "chrome/browser/chromeos/cros/mock_cert_library.h" 16 #include "chrome/browser/chromeos/cros/mock_cert_library.h"
17 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" 17 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h"
18 #include "chrome/browser/chromeos/login/mock_login_status_consumer.h" 18 #include "chrome/browser/chromeos/login/mock_login_status_consumer.h"
19 #include "chrome/browser/chromeos/login/mock_url_fetchers.h" 19 #include "chrome/browser/chromeos/login/mock_url_fetchers.h"
20 #include "chrome/browser/chromeos/login/mock_user_manager.h" 20 #include "chrome/browser/chromeos/login/mock_user_manager.h"
21 #include "chrome/browser/chromeos/login/test_attempt_state.h" 21 #include "chrome/browser/chromeos/login/test_attempt_state.h"
22 #include "chrome/browser/chromeos/settings/cros_settings.h" 22 #include "chrome/browser/chromeos/settings/cros_settings.h"
23 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
24 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" 23 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h"
25 #include "chrome/common/net/gaia/mock_url_fetcher_factory.h" 24 #include "chrome/common/net/gaia/mock_url_fetcher_factory.h"
26 #include "chrome/test/base/testing_profile.h" 25 #include "chrome/test/base/testing_profile.h"
27 #include "chromeos/cryptohome/mock_async_method_caller.h" 26 #include "chromeos/cryptohome/mock_async_method_caller.h"
28 #include "chromeos/dbus/mock_cryptohome_client.h" 27 #include "chromeos/dbus/mock_cryptohome_client.h"
29 #include "chromeos/dbus/mock_dbus_thread_manager.h" 28 #include "chromeos/dbus/mock_dbus_thread_manager.h"
30 #include "content/public/test/test_browser_thread.h" 29 #include "content/public/test/test_browser_thread.h"
31 #include "googleurl/src/gurl.h" 30 #include "googleurl/src/gurl.h"
32 #include "net/base/net_errors.h" 31 #include "net/base/net_errors.h"
33 #include "net/url_request/url_request_status.h" 32 #include "net/url_request/url_request_status.h"
34 #include "testing/gmock/include/gmock/gmock.h" 33 #include "testing/gmock/include/gmock/gmock.h"
35 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
36 #include "third_party/cros_system_api/dbus/service_constants.h" 35 #include "third_party/cros_system_api/dbus/service_constants.h"
37 36
37 using content::BrowserThread;
38 using ::testing::AnyNumber; 38 using ::testing::AnyNumber;
39 using ::testing::DoAll; 39 using ::testing::DoAll;
40 using ::testing::Invoke; 40 using ::testing::Invoke;
41 using ::testing::Return; 41 using ::testing::Return;
42 using ::testing::SetArgPointee; 42 using ::testing::SetArgPointee;
43 using ::testing::_; 43 using ::testing::_;
44 using content::BrowserThread;
45 44
46 namespace chromeos { 45 namespace chromeos {
47 46
48 class TestOnlineAttempt : public OnlineAttempt { 47 class TestOnlineAttempt : public OnlineAttempt {
49 public: 48 public:
50 TestOnlineAttempt(AuthAttemptState* state, 49 TestOnlineAttempt(AuthAttemptState* state,
51 AuthAttemptStateResolver* resolver) 50 AuthAttemptStateResolver* resolver)
52 : OnlineAttempt(false, state, resolver) { 51 : OnlineAttempt(false, state, resolver) {
53 } 52 }
54 }; 53 };
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 201
203 MessageLoop message_loop_; 202 MessageLoop message_loop_;
204 content::TestBrowserThread ui_thread_; 203 content::TestBrowserThread ui_thread_;
205 content::TestBrowserThread file_thread_; 204 content::TestBrowserThread file_thread_;
206 content::TestBrowserThread io_thread_; 205 content::TestBrowserThread io_thread_;
207 206
208 std::string username_; 207 std::string username_;
209 std::string password_; 208 std::string password_;
210 std::string hash_ascii_; 209 std::string hash_ascii_;
211 210
212 ScopedDeviceSettingsTestHelper device_settings_test_helper_;
213
214 // Initializes / shuts down a stub CrosLibrary. 211 // Initializes / shuts down a stub CrosLibrary.
215 ScopedStubCrosEnabler stub_cros_enabler_; 212 chromeos::ScopedStubCrosEnabler stub_cros_enabler_;
216 213
217 // Mocks, destroyed by CrosLibrary class. 214 // Mocks, destroyed by CrosLibrary class.
218 MockCertLibrary* mock_cert_library_; 215 MockCertLibrary* mock_cert_library_;
219 MockCryptohomeLibrary* mock_cryptohome_library_; 216 MockCryptohomeLibrary* mock_cryptohome_library_;
220 ScopedMockUserManagerEnabler mock_user_manager_; 217 ScopedMockUserManagerEnabler mock_user_manager_;
221 218
222 cryptohome::MockAsyncMethodCaller* mock_caller_; 219 cryptohome::MockAsyncMethodCaller* mock_caller_;
223 220
224 MockConsumer consumer_; 221 MockConsumer consumer_;
225 scoped_refptr<ParallelAuthenticator> auth_; 222 scoped_refptr<ParallelAuthenticator> auth_;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 device_settings_provider = 333 device_settings_provider =
337 CrosSettings::Get()->GetProvider(chromeos::kReportDeviceVersionInfo); 334 CrosSettings::Get()->GetProvider(chromeos::kReportDeviceVersionInfo);
338 EXPECT_TRUE(device_settings_provider != NULL); 335 EXPECT_TRUE(device_settings_provider != NULL);
339 EXPECT_TRUE( 336 EXPECT_TRUE(
340 CrosSettings::Get()->RemoveSettingsProvider(device_settings_provider)); 337 CrosSettings::Get()->RemoveSettingsProvider(device_settings_provider));
341 CrosSettings::Get()->AddSettingsProvider(&stub_settings_provider); 338 CrosSettings::Get()->AddSettingsProvider(&stub_settings_provider);
342 CrosSettings::Get()->SetBoolean(kPolicyMissingMitigationMode, true); 339 CrosSettings::Get()->SetBoolean(kPolicyMissingMitigationMode, true);
343 340
344 EXPECT_EQ(ParallelAuthenticator::CONTINUE, 341 EXPECT_EQ(ParallelAuthenticator::CONTINUE,
345 SetAndResolveState(auth_, state_.release())); 342 SetAndResolveState(auth_, state_.release()));
346 // Let the owner verification run. 343 // Let the owner verification run on the FILE thread...
347 device_settings_test_helper_.Flush(); 344 message_loop_.RunAllPending();
348 // and test that the mount has succeeded. 345 // and test that the mount has succeeded.
349 state_.reset(new TestAttemptState(username_, 346 state_.reset(new TestAttemptState(username_,
350 password_, 347 password_,
351 hash_ascii_, 348 hash_ascii_,
352 "", 349 "",
353 "", 350 "",
354 false)); 351 false));
355 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); 352 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE);
356 EXPECT_EQ(ParallelAuthenticator::OWNER_REQUIRED, 353 EXPECT_EQ(ParallelAuthenticator::OWNER_REQUIRED,
357 SetAndResolveState(auth_, state_.release())); 354 SetAndResolveState(auth_, state_.release()));
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 .RetiresOnSaturation(); 752 .RetiresOnSaturation();
756 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt()) 753 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt())
757 .WillOnce(Return(std::string())) 754 .WillOnce(Return(std::string()))
758 .RetiresOnSaturation(); 755 .RetiresOnSaturation();
759 756
760 auth_->AuthenticateToUnlock(username_, ""); 757 auth_->AuthenticateToUnlock(username_, "");
761 message_loop_.Run(); 758 message_loop_.Run();
762 } 759 }
763 760
764 } // namespace chromeos 761 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/parallel_authenticator.cc ('k') | chrome/browser/chromeos/login/screen_locker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698