OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Unit tests for MockGaiaAuthenticator. | 5 // Unit tests for MockGaiaAuthenticator. |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/port.h" | 8 #include "base/port.h" |
9 #include "chrome/browser/sync/protocol/service_constants.h" | 9 #include "chrome/browser/sync/protocol/service_constants.h" |
| 10 #include "chrome/browser/sync/test/engine/mock_gaia_authenticator.h" |
10 #include "chrome/common/net/gaia/gaia_authenticator.h" | 11 #include "chrome/common/net/gaia/gaia_authenticator.h" |
11 #include "chrome/test/sync/engine/mock_gaia_authenticator.h" | |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Test if authentication succeeds for a mock user added earlier. | 16 // Test if authentication succeeds for a mock user added earlier. |
17 TEST(MockGaiaAuthenticatorTest, TestAuthenticationSuccess) { | 17 TEST(MockGaiaAuthenticatorTest, TestAuthenticationSuccess) { |
18 browser_sync::MockGaiaAuthenticator | 18 browser_sync::MockGaiaAuthenticator |
19 mock_gaia_auth("User-Agent", SYNC_SERVICE_NAME, | 19 mock_gaia_auth("User-Agent", SYNC_SERVICE_NAME, |
20 "some random url"); | 20 "some random url"); |
21 | 21 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 ASSERT_STREQ(mock_gaia_auth.email().c_str(), ""); | 149 ASSERT_STREQ(mock_gaia_auth.email().c_str(), ""); |
150 ASSERT_FALSE(mock_gaia_auth.Authenticate()); | 150 ASSERT_FALSE(mock_gaia_auth.Authenticate()); |
151 | 151 |
152 // And assert that any future requests that rely on saved credentials fail. | 152 // And assert that any future requests that rely on saved credentials fail. |
153 ASSERT_STREQ(mock_gaia_auth.auth_token().c_str(), ""); | 153 ASSERT_STREQ(mock_gaia_auth.auth_token().c_str(), ""); |
154 ASSERT_STREQ(mock_gaia_auth.sid().c_str(), ""); | 154 ASSERT_STREQ(mock_gaia_auth.sid().c_str(), ""); |
155 ASSERT_STREQ(mock_gaia_auth.lsid().c_str(), ""); | 155 ASSERT_STREQ(mock_gaia_auth.lsid().c_str(), ""); |
156 } | 156 } |
157 | 157 |
158 } // namespace | 158 } // namespace |
OLD | NEW |