| OLD | NEW |
| 1 // Copyright (c) 2011 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 "chrome/common/net/gaia/google_service_auth_error.h" | 5 #include "chrome/common/net/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/values.h" | 11 #include "base/values.h" |
| 11 #include "chrome/test/base/values_test_util.h" | |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 using test::ExpectDictStringValue; | 17 using base::ExpectDictStringValue; |
| 18 | 18 |
| 19 class GoogleServiceAuthErrorTest : public testing::Test {}; | 19 class GoogleServiceAuthErrorTest : public testing::Test {}; |
| 20 | 20 |
| 21 void TestSimpleState(GoogleServiceAuthError::State state) { | 21 void TestSimpleState(GoogleServiceAuthError::State state) { |
| 22 GoogleServiceAuthError error(state); | 22 GoogleServiceAuthError error(state); |
| 23 scoped_ptr<DictionaryValue> value(error.ToValue()); | 23 scoped_ptr<DictionaryValue> value(error.ToValue()); |
| 24 EXPECT_EQ(1u, value->size()); | 24 EXPECT_EQ(1u, value->size()); |
| 25 std::string state_str; | 25 std::string state_str; |
| 26 EXPECT_TRUE(value->GetString("state", &state_str)); | 26 EXPECT_TRUE(value->GetString("state", &state_str)); |
| 27 EXPECT_FALSE(state_str.empty()); | 27 EXPECT_FALSE(state_str.empty()); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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("http://www.google.com/", *captcha_value, "imageUrl"); | 67 ExpectDictStringValue("http://www.google.com/", *captcha_value, "imageUrl"); |
| 68 ExpectDictStringValue("http://www.bing.com/", *captcha_value, "unlockUrl"); | 68 ExpectDictStringValue("http://www.bing.com/", *captcha_value, "unlockUrl"); |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace | 71 } // namespace |
| OLD | NEW |