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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 307 |
308 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTests); ++i) { | 308 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTests); ++i) { |
309 client_.SetHTTPRequest(kTests[i].request_type, kTests[i].request_text, | 309 client_.SetHTTPRequest(kTests[i].request_type, kTests[i].request_text, |
310 kTests[i].language); | 310 kTests[i].language); |
311 client_.SetHTTPResponse(kTests[i].response_status, kTests[i].response_data); | 311 client_.SetHTTPResponse(kTests[i].response_status, kTests[i].response_data); |
312 client_.SetExpectedTextCheckResult(kTests[i].success, | 312 client_.SetExpectedTextCheckResult(kTests[i].success, |
313 kTests[i].corrected_text); | 313 kTests[i].corrected_text); |
314 pref->SetString(prefs::kSpellCheckDictionary, kTests[i].language); | 314 pref->SetString(prefs::kSpellCheckDictionary, kTests[i].language); |
315 client_.RequestTextCheck( | 315 client_.RequestTextCheck( |
316 &profile_, | 316 &profile_, |
317 0, | |
318 kTests[i].request_type, | 317 kTests[i].request_type, |
319 ASCIIToUTF16(kTests[i].request_text), | 318 ASCIIToUTF16(kTests[i].request_text), |
320 base::Bind(&SpellingServiceClientTest::OnTextCheckComplete, | 319 base::Bind(&SpellingServiceClientTest::OnTextCheckComplete, |
321 base::Unretained(this))); | 320 base::Unretained(this), 0)); |
322 client_.CallOnURLFetchComplete(); | 321 client_.CallOnURLFetchComplete(); |
323 } | 322 } |
324 } | 323 } |
325 | 324 |
326 // Verify that SpellingServiceClient::IsAvailable() returns true only when it | 325 // Verify that SpellingServiceClient::IsAvailable() returns true only when it |
327 // can send suggest requests or spellcheck requests. | 326 // can send suggest requests or spellcheck requests. |
328 TEST_F(SpellingServiceClientTest, AvailableServices) { | 327 TEST_F(SpellingServiceClientTest, AvailableServices) { |
329 const SpellingServiceClient::ServiceType kSuggest = | 328 const SpellingServiceClient::ServiceType kSuggest = |
330 SpellingServiceClient::SUGGEST; | 329 SpellingServiceClient::SUGGEST; |
331 const SpellingServiceClient::ServiceType kSpellcheck = | 330 const SpellingServiceClient::ServiceType kSpellcheck = |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 "ro-RO", "ru-RU", "sk-SK", "sl-SI", "sh", "sr", "sv-SE", "tr-TR", | 373 "ro-RO", "ru-RU", "sk-SK", "sl-SI", "sh", "sr", "sv-SE", "tr-TR", |
375 "uk-UA", "vi-VN", | 374 "uk-UA", "vi-VN", |
376 #endif | 375 #endif |
377 }; | 376 }; |
378 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kUnsupported); ++i) { | 377 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kUnsupported); ++i) { |
379 pref->SetString(prefs::kSpellCheckDictionary, kUnsupported[i]); | 378 pref->SetString(prefs::kSpellCheckDictionary, kUnsupported[i]); |
380 EXPECT_TRUE(client_.IsAvailable(&profile_, kSuggest)); | 379 EXPECT_TRUE(client_.IsAvailable(&profile_, kSuggest)); |
381 EXPECT_FALSE(client_.IsAvailable(&profile_, kSpellcheck)); | 380 EXPECT_FALSE(client_.IsAvailable(&profile_, kSpellcheck)); |
382 } | 381 } |
383 } | 382 } |
OLD | NEW |