| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 GoogleServiceAuthError::FromClientLoginCaptchaChallenge( | 57 GoogleServiceAuthError::FromClientLoginCaptchaChallenge( |
| 58 "captcha_token", GURL("http://www.google.com"), | 58 "captcha_token", GURL("http://www.google.com"), |
| 59 GURL("http://www.bing.com"))); | 59 GURL("http://www.bing.com"))); |
| 60 scoped_ptr<DictionaryValue> value(error.ToValue()); | 60 scoped_ptr<DictionaryValue> value(error.ToValue()); |
| 61 EXPECT_EQ(2u, value->size()); | 61 EXPECT_EQ(2u, value->size()); |
| 62 ExpectDictStringValue("CAPTCHA_REQUIRED", *value, "state"); | 62 ExpectDictStringValue("CAPTCHA_REQUIRED", *value, "state"); |
| 63 DictionaryValue* captcha_value = NULL; | 63 DictionaryValue* captcha_value = NULL; |
| 64 EXPECT_TRUE(value->GetDictionary("captcha", &captcha_value)); | 64 EXPECT_TRUE(value->GetDictionary("captcha", &captcha_value)); |
| 65 ASSERT_TRUE(captcha_value); | 65 ASSERT_TRUE(captcha_value); |
| 66 ExpectDictStringValue("captcha_token", *captcha_value, "token"); | 66 ExpectDictStringValue("captcha_token", *captcha_value, "token"); |
| 67 ExpectDictStringValue("", *captcha_value, "audioUrl"); | 67 ExpectDictStringValue(std::string(), *captcha_value, "audioUrl"); |
| 68 ExpectDictStringValue("http://www.google.com/", *captcha_value, "imageUrl"); | 68 ExpectDictStringValue("http://www.google.com/", *captcha_value, "imageUrl"); |
| 69 ExpectDictStringValue("http://www.bing.com/", *captcha_value, "unlockUrl"); | 69 ExpectDictStringValue("http://www.bing.com/", *captcha_value, "unlockUrl"); |
| 70 ExpectDictIntegerValue(0, *captcha_value, "imageWidth"); | 70 ExpectDictIntegerValue(0, *captcha_value, "imageWidth"); |
| 71 ExpectDictIntegerValue(0, *captcha_value, "imageHeight"); | 71 ExpectDictIntegerValue(0, *captcha_value, "imageHeight"); |
| 72 } | 72 } |
| 73 | 73 |
| 74 TEST_F(GoogleServiceAuthErrorTest, CaptchaChallenge2) { | 74 TEST_F(GoogleServiceAuthErrorTest, CaptchaChallenge2) { |
| 75 GoogleServiceAuthError error( | 75 GoogleServiceAuthError error( |
| 76 GoogleServiceAuthError::FromCaptchaChallenge( | 76 GoogleServiceAuthError::FromCaptchaChallenge( |
| 77 "captcha_token", GURL("http://www.audio.com"), | 77 "captcha_token", GURL("http://www.audio.com"), |
| (...skipping 37 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 |