OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "google_apis/gaia/google_service_auth_error.h" | 5 #include "google_apis/gaia/google_service_auth_error.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/test/values_test_util.h" | 10 #include "base/test/values_test_util.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 | 31 |
32 TEST_F(GoogleServiceAuthErrorTest, SimpleToValue) { | 32 TEST_F(GoogleServiceAuthErrorTest, SimpleToValue) { |
33 for (int i = GoogleServiceAuthError::NONE; | 33 for (int i = GoogleServiceAuthError::NONE; |
34 i <= GoogleServiceAuthError::USER_NOT_SIGNED_UP; ++i) { | 34 i <= GoogleServiceAuthError::USER_NOT_SIGNED_UP; ++i) { |
35 TestSimpleState(static_cast<GoogleServiceAuthError::State>(i)); | 35 TestSimpleState(static_cast<GoogleServiceAuthError::State>(i)); |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
39 TEST_F(GoogleServiceAuthErrorTest, None) { | 39 TEST_F(GoogleServiceAuthErrorTest, None) { |
40 GoogleServiceAuthError error(GoogleServiceAuthError::None()); | 40 GoogleServiceAuthError error(GoogleServiceAuthError::AuthErrorNone()); |
41 scoped_ptr<DictionaryValue> value(error.ToValue()); | 41 scoped_ptr<DictionaryValue> value(error.ToValue()); |
42 EXPECT_EQ(1u, value->size()); | 42 EXPECT_EQ(1u, value->size()); |
43 ExpectDictStringValue("NONE", *value, "state"); | 43 ExpectDictStringValue("NONE", *value, "state"); |
44 } | 44 } |
45 | 45 |
46 TEST_F(GoogleServiceAuthErrorTest, ConnectionFailed) { | 46 TEST_F(GoogleServiceAuthErrorTest, ConnectionFailed) { |
47 GoogleServiceAuthError error( | 47 GoogleServiceAuthError error( |
48 GoogleServiceAuthError::FromConnectionError(net::OK)); | 48 GoogleServiceAuthError::FromConnectionError(net::OK)); |
49 scoped_ptr<DictionaryValue> value(error.ToValue()); | 49 scoped_ptr<DictionaryValue> value(error.ToValue()); |
50 EXPECT_EQ(2u, value->size()); | 50 EXPECT_EQ(2u, value->size()); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // Test that a well formed ClientOAuth response generates an invalid | 115 // Test that a well formed ClientOAuth response generates an invalid |
116 // credentials error with the given error message. | 116 // credentials error with the given error message. |
117 GoogleServiceAuthError error2( | 117 GoogleServiceAuthError error2( |
118 GoogleServiceAuthError::FromClientOAuthError( | 118 GoogleServiceAuthError::FromClientOAuthError( |
119 "{\"cause\":\"foo\",\"explanation\":\"error_message\"}")); | 119 "{\"cause\":\"foo\",\"explanation\":\"error_message\"}")); |
120 EXPECT_EQ(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, error2.state()); | 120 EXPECT_EQ(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, error2.state()); |
121 EXPECT_EQ("error_message", error2.error_message()); | 121 EXPECT_EQ("error_message", error2.error_message()); |
122 } | 122 } |
123 | 123 |
124 } // namespace | 124 } // namespace |
OLD | NEW |