OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/stringprintf.h" | 16 #include "base/stringprintf.h" |
17 #include "base/test/thread_test_helper.h" | 17 #include "base/test/thread_test_helper.h" |
18 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" | 18 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" |
19 #include "chrome/browser/chromeos/cros/mock_library_loader.h" | 19 #include "chrome/browser/chromeos/cros/mock_library_loader.h" |
20 #include "chrome/browser/chromeos/login/mock_auth_response_handler.h" | 20 #include "chrome/browser/chromeos/login/mock_auth_response_handler.h" |
21 #include "chrome/browser/chromeos/login/mock_login_status_consumer.h" | 21 #include "chrome/browser/chromeos/login/mock_login_status_consumer.h" |
22 #include "chrome/browser/chromeos/login/mock_url_fetchers.h" | 22 #include "chrome/browser/chromeos/login/mock_url_fetchers.h" |
23 #include "chrome/browser/chromeos/login/test_attempt_state.h" | 23 #include "chrome/browser/chromeos/login/test_attempt_state.h" |
24 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
25 #include "chrome/common/net/gaia/gaia_auth_fetcher_unittest.h" | 25 #include "chrome/common/net/gaia/gaia_auth_fetcher_unittest.h" |
| 26 #include "chrome/test/base/testing_browser_process_test.h" |
26 #include "chrome/test/base/testing_profile.h" | 27 #include "chrome/test/base/testing_profile.h" |
27 #include "content/browser/browser_thread.h" | 28 #include "content/browser/browser_thread.h" |
28 #include "content/common/url_fetcher.h" | 29 #include "content/common/url_fetcher.h" |
29 #include "googleurl/src/gurl.h" | 30 #include "googleurl/src/gurl.h" |
30 #include "net/base/net_errors.h" | 31 #include "net/base/net_errors.h" |
31 #include "net/url_request/url_request_status.h" | 32 #include "net/url_request/url_request_status.h" |
32 #include "testing/gmock/include/gmock/gmock.h" | 33 #include "testing/gmock/include/gmock/gmock.h" |
33 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
34 | 35 |
35 using file_util::CloseFile; | 36 using file_util::CloseFile; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 }; | 72 }; |
72 | 73 |
73 class TestOnlineAttempt : public OnlineAttempt { | 74 class TestOnlineAttempt : public OnlineAttempt { |
74 public: | 75 public: |
75 TestOnlineAttempt(AuthAttemptState* state, | 76 TestOnlineAttempt(AuthAttemptState* state, |
76 AuthAttemptStateResolver* resolver) | 77 AuthAttemptStateResolver* resolver) |
77 : OnlineAttempt(false, state, resolver) { | 78 : OnlineAttempt(false, state, resolver) { |
78 } | 79 } |
79 }; | 80 }; |
80 | 81 |
81 class ParallelAuthenticatorTest : public ::testing::Test { | 82 class ParallelAuthenticatorTest : public TestingBrowserProcessTest { |
82 public: | 83 public: |
83 ParallelAuthenticatorTest() | 84 ParallelAuthenticatorTest() |
84 : message_loop_(MessageLoop::TYPE_UI), | 85 : message_loop_(MessageLoop::TYPE_UI), |
85 ui_thread_(BrowserThread::UI, &message_loop_), | 86 ui_thread_(BrowserThread::UI, &message_loop_), |
86 file_thread_(BrowserThread::FILE), | 87 file_thread_(BrowserThread::FILE), |
87 io_thread_(BrowserThread::IO), | 88 io_thread_(BrowserThread::IO), |
88 username_("me@nowhere.org"), | 89 username_("me@nowhere.org"), |
89 password_("fakepass") { | 90 password_("fakepass") { |
90 hash_ascii_.assign("0a010000000000a0"); | 91 hash_ascii_.assign("0a010000000000a0"); |
91 hash_ascii_.append(std::string(16, '0')); | 92 hash_ascii_.append(std::string(16, '0')); |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 FilePath tmp_file_path = FakeLocalaccountFile(username_); | 791 FilePath tmp_file_path = FakeLocalaccountFile(username_); |
791 ReadLocalaccountFile(auth_.get(), tmp_file_path.BaseName().value()); | 792 ReadLocalaccountFile(auth_.get(), tmp_file_path.BaseName().value()); |
792 | 793 |
793 auth_->AuthenticateToUnlock(username_, ""); | 794 auth_->AuthenticateToUnlock(username_, ""); |
794 message_loop_.Run(); | 795 message_loop_.Run(); |
795 | 796 |
796 Delete(tmp_file_path, false); | 797 Delete(tmp_file_path, false); |
797 } | 798 } |
798 | 799 |
799 } // namespace chromeos | 800 } // namespace chromeos |
OLD | NEW |