OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/google_authenticator.h" | 5 #include "chrome/browser/chromeos/login/google_authenticator.h" |
6 #include "chrome/browser/chromeos/login/client_login_response_handler.h" | 6 #include "chrome/browser/chromeos/login/client_login_response_handler.h" |
7 #include "chrome/browser/chromeos/login/issue_response_handler.h" | 7 #include "chrome/browser/chromeos/login/issue_response_handler.h" |
8 | 8 |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <string> | 10 #include <string> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 .Times(AnyNumber()); | 60 .Times(AnyNumber()); |
61 | 61 |
62 test_api->SetLibraryLoader(loader_); | 62 test_api->SetLibraryLoader(loader_); |
63 | 63 |
64 mock_library_ = new MockCryptohomeLibrary(); | 64 mock_library_ = new MockCryptohomeLibrary(); |
65 test_api->SetCryptohomeLibrary(mock_library_); | 65 test_api->SetCryptohomeLibrary(mock_library_); |
66 } | 66 } |
67 | 67 |
68 // Tears down the test fixture. | 68 // Tears down the test fixture. |
69 virtual void TearDown() { | 69 virtual void TearDown() { |
| 70 // Prevent bogus gMock leak check from firing. |
| 71 chromeos::CrosLibrary::TestApi* test_api = |
| 72 chromeos::CrosLibrary::Get()->GetTestApi(); |
| 73 test_api->SetLibraryLoader(NULL); |
| 74 test_api->SetCryptohomeLibrary(NULL); |
70 } | 75 } |
71 | 76 |
72 unsigned char fake_hash_[32]; | 77 unsigned char fake_hash_[32]; |
73 std::string hash_ascii_; | 78 std::string hash_ascii_; |
74 std::string username_; | 79 std::string username_; |
75 ResponseCookies cookies_; | 80 ResponseCookies cookies_; |
76 // Mocks, destroyed by CrosLibrary class. | 81 // Mocks, destroyed by CrosLibrary class. |
77 MockCryptohomeLibrary* mock_library_; | 82 MockCryptohomeLibrary* mock_library_; |
78 MockLibraryLoader* loader_; | 83 MockLibraryLoader* loader_; |
79 }; | 84 }; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 GoogleAuthenticator auth(&consumer, | 260 GoogleAuthenticator auth(&consumer, |
256 new ClientLoginResponseHandler(NULL), | 261 new ClientLoginResponseHandler(NULL), |
257 new IssueResponseHandler(NULL)); | 262 new IssueResponseHandler(NULL)); |
258 auth.set_password_hash(hash_ascii_); | 263 auth.set_password_hash(hash_ascii_); |
259 auth.set_username(username_); | 264 auth.set_username(username_); |
260 auth.OnURLFetchComplete(NULL, source, status, 200, cookies_, std::string()); | 265 auth.OnURLFetchComplete(NULL, source, status, 200, cookies_, std::string()); |
261 MessageLoop::current()->Run(); // So tasks can be posted. | 266 MessageLoop::current()->Run(); // So tasks can be posted. |
262 } | 267 } |
263 | 268 |
264 } // namespace chromeos | 269 } // namespace chromeos |
OLD | NEW |