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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/prefs/pref_service.h" | |
15 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
16 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
17 #include "base/values.h" | 16 #include "base/values.h" |
18 #include "chrome/browser/spellchecker/spelling_service_client.h" | 17 #include "chrome/browser/spellchecker/spelling_service_client.h" |
19 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
20 #include "chrome/common/spellcheck_result.h" | 19 #include "chrome/common/spellcheck_result.h" |
21 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
| 21 #include "components/prefs/pref_service.h" |
22 #include "content/public/test/test_browser_thread_bundle.h" | 22 #include "content/public/test/test_browser_thread_bundle.h" |
23 #include "net/base/load_flags.h" | 23 #include "net/base/load_flags.h" |
24 #include "net/url_request/test_url_fetcher_factory.h" | 24 #include "net/url_request/test_url_fetcher_factory.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 // A mock URL fetcher used in the TestingSpellingServiceClient class. This class | 29 // A mock URL fetcher used in the TestingSpellingServiceClient class. This class |
30 // verifies JSON-RPC requests when the SpellingServiceClient class sends them to | 30 // verifies JSON-RPC requests when the SpellingServiceClient class sends them to |
31 // the Spelling service. This class also verifies the SpellingServiceClient | 31 // the Spelling service. This class also verifies the SpellingServiceClient |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 EXPECT_FALSE(client_.IsAvailable(&profile_, kSpellcheck)); | 413 EXPECT_FALSE(client_.IsAvailable(&profile_, kSpellcheck)); |
414 } | 414 } |
415 } | 415 } |
416 | 416 |
417 // Verify that an error in JSON response from spelling service will result in | 417 // Verify that an error in JSON response from spelling service will result in |
418 // ParseResponse returning false. | 418 // ParseResponse returning false. |
419 TEST_F(SpellingServiceClientTest, ResponseErrorTest) { | 419 TEST_F(SpellingServiceClientTest, ResponseErrorTest) { |
420 EXPECT_TRUE(client_.ParseResponseSuccess("{\"result\": {}}")); | 420 EXPECT_TRUE(client_.ParseResponseSuccess("{\"result\": {}}")); |
421 EXPECT_FALSE(client_.ParseResponseSuccess("{\"error\": {}}")); | 421 EXPECT_FALSE(client_.ParseResponseSuccess("{\"error\": {}}")); |
422 } | 422 } |
OLD | NEW |