| 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" | |
| 27 #include "chrome/test/base/testing_profile.h" | 26 #include "chrome/test/base/testing_profile.h" |
| 28 #include "content/browser/browser_thread.h" | 27 #include "content/browser/browser_thread.h" |
| 29 #include "content/common/url_fetcher.h" | 28 #include "content/common/url_fetcher.h" |
| 30 #include "googleurl/src/gurl.h" | 29 #include "googleurl/src/gurl.h" |
| 31 #include "net/base/net_errors.h" | 30 #include "net/base/net_errors.h" |
| 32 #include "net/url_request/url_request_status.h" | 31 #include "net/url_request/url_request_status.h" |
| 33 #include "testing/gmock/include/gmock/gmock.h" | 32 #include "testing/gmock/include/gmock/gmock.h" |
| 34 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
| 35 | 34 |
| 36 using file_util::CloseFile; | 35 using file_util::CloseFile; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 }; | 71 }; |
| 73 | 72 |
| 74 class TestOnlineAttempt : public OnlineAttempt { | 73 class TestOnlineAttempt : public OnlineAttempt { |
| 75 public: | 74 public: |
| 76 TestOnlineAttempt(AuthAttemptState* state, | 75 TestOnlineAttempt(AuthAttemptState* state, |
| 77 AuthAttemptStateResolver* resolver) | 76 AuthAttemptStateResolver* resolver) |
| 78 : OnlineAttempt(false, state, resolver) { | 77 : OnlineAttempt(false, state, resolver) { |
| 79 } | 78 } |
| 80 }; | 79 }; |
| 81 | 80 |
| 82 class ParallelAuthenticatorTest : public TestingBrowserProcessTest { | 81 class ParallelAuthenticatorTest : public testing::Test { |
| 83 public: | 82 public: |
| 84 ParallelAuthenticatorTest() | 83 ParallelAuthenticatorTest() |
| 85 : message_loop_(MessageLoop::TYPE_UI), | 84 : message_loop_(MessageLoop::TYPE_UI), |
| 86 ui_thread_(BrowserThread::UI, &message_loop_), | 85 ui_thread_(BrowserThread::UI, &message_loop_), |
| 87 file_thread_(BrowserThread::FILE), | 86 file_thread_(BrowserThread::FILE), |
| 88 io_thread_(BrowserThread::IO), | 87 io_thread_(BrowserThread::IO), |
| 89 username_("me@nowhere.org"), | 88 username_("me@nowhere.org"), |
| 90 password_("fakepass") { | 89 password_("fakepass") { |
| 91 hash_ascii_.assign("0a010000000000a0"); | 90 hash_ascii_.assign("0a010000000000a0"); |
| 92 hash_ascii_.append(std::string(16, '0')); | 91 hash_ascii_.append(std::string(16, '0')); |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 FilePath tmp_file_path = FakeLocalaccountFile(username_); | 790 FilePath tmp_file_path = FakeLocalaccountFile(username_); |
| 792 ReadLocalaccountFile(auth_.get(), tmp_file_path.BaseName().value()); | 791 ReadLocalaccountFile(auth_.get(), tmp_file_path.BaseName().value()); |
| 793 | 792 |
| 794 auth_->AuthenticateToUnlock(username_, ""); | 793 auth_->AuthenticateToUnlock(username_, ""); |
| 795 message_loop_.Run(); | 794 message_loop_.Run(); |
| 796 | 795 |
| 797 Delete(tmp_file_path, false); | 796 Delete(tmp_file_path, false); |
| 798 } | 797 } |
| 799 | 798 |
| 800 } // namespace chromeos | 799 } // namespace chromeos |
| OLD | NEW |