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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "chrome/browser/chromeos/cros/cros_library.h" | 9 #include "chrome/browser/chromeos/cros/cros_library.h" |
10 #include "chrome/browser/chromeos/cros/mock_library_loader.h" | 10 #include "chrome/browser/chromeos/cros/mock_library_loader.h" |
11 #include "chrome/browser/chromeos/login/auth_attempt_state.h" | 11 #include "chrome/browser/chromeos/login/auth_attempt_state.h" |
12 #include "chrome/browser/chromeos/login/mock_auth_attempt_state_resolver.h" | 12 #include "chrome/browser/chromeos/login/mock_auth_attempt_state_resolver.h" |
13 #include "chrome/browser/chromeos/login/mock_url_fetchers.h" | 13 #include "chrome/browser/chromeos/login/mock_url_fetchers.h" |
14 #include "chrome/browser/chromeos/login/online_attempt.h" | 14 #include "chrome/browser/chromeos/login/online_attempt.h" |
15 #include "chrome/browser/chromeos/login/test_attempt_state.h" | 15 #include "chrome/browser/chromeos/login/test_attempt_state.h" |
16 #include "chrome/common/net/gaia/gaia_auth_consumer.h" | 16 #include "chrome/common/net/gaia/gaia_auth_consumer.h" |
17 #include "chrome/common/net/gaia/gaia_auth_fetcher_unittest.h" | 17 #include "chrome/common/net/gaia/gaia_auth_fetcher_unittest.h" |
| 18 #include "chrome/test/base/testing_browser_process_test.h" |
18 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
19 #include "content/browser/browser_thread.h" | 20 #include "content/browser/browser_thread.h" |
20 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
21 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
23 | 24 |
24 using ::testing::AnyNumber; | 25 using ::testing::AnyNumber; |
25 using ::testing::Invoke; | 26 using ::testing::Invoke; |
26 using ::testing::Return; | 27 using ::testing::Return; |
27 using ::testing::_; | 28 using ::testing::_; |
28 | 29 |
29 namespace chromeos { | 30 namespace chromeos { |
30 | 31 |
31 class OnlineAttemptTest : public ::testing::Test { | 32 class OnlineAttemptTest : public TestingBrowserProcessTest { |
32 public: | 33 public: |
33 OnlineAttemptTest() | 34 OnlineAttemptTest() |
34 : message_loop_(MessageLoop::TYPE_UI), | 35 : message_loop_(MessageLoop::TYPE_UI), |
35 ui_thread_(BrowserThread::UI, &message_loop_), | 36 ui_thread_(BrowserThread::UI, &message_loop_), |
36 io_thread_(BrowserThread::IO), | 37 io_thread_(BrowserThread::IO), |
37 state_("", "", "", "", "", false), | 38 state_("", "", "", "", "", false), |
38 resolver_(new MockAuthAttemptStateResolver) { | 39 resolver_(new MockAuthAttemptStateResolver) { |
39 } | 40 } |
40 | 41 |
41 virtual ~OnlineAttemptTest() {} | 42 virtual ~OnlineAttemptTest() {} |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 error)); | 268 error)); |
268 | 269 |
269 // Force IO thread to finish tasks so I can verify |state_|. | 270 // Force IO thread to finish tasks so I can verify |state_|. |
270 io_thread_.Stop(); | 271 io_thread_.Stop(); |
271 EXPECT_TRUE(GoogleServiceAuthError::None() == | 272 EXPECT_TRUE(GoogleServiceAuthError::None() == |
272 state_.online_outcome().error()); | 273 state_.online_outcome().error()); |
273 EXPECT_TRUE(GaiaAuthConsumer::ClientLoginResult() == state_.credentials()); | 274 EXPECT_TRUE(GaiaAuthConsumer::ClientLoginResult() == state_.credentials()); |
274 } | 275 } |
275 | 276 |
276 } // namespace chromeos | 277 } // namespace chromeos |
OLD | NEW |