| 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/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 // A mock URL fetcher used in the TestingSpellingServiceClient class. This class | 22 // A mock URL fetcher used in the TestingSpellingServiceClient class. This class |
| 23 // verifies JSON-RPC requests when the SpellingServiceClient class sends them to | 23 // verifies JSON-RPC requests when the SpellingServiceClient class sends them to |
| 24 // the Spelling service. This class also verifies the SpellingServiceClient | 24 // the Spelling service. This class also verifies the SpellingServiceClient |
| 25 // class does not either send cookies to the Spelling service or accept cookies | 25 // class does not either send cookies to the Spelling service or accept cookies |
| 26 // from it. | 26 // from it. |
| 27 class TestSpellingURLFetcher : public TestURLFetcher { | 27 class TestSpellingURLFetcher : public TestURLFetcher { |
| 28 public: | 28 public: |
| 29 TestSpellingURLFetcher(int id, | 29 TestSpellingURLFetcher(int id, |
| 30 const GURL& url, | 30 const GURL& url, |
| 31 content::URLFetcherDelegate* d, | 31 net::URLFetcherDelegate* d, |
| 32 int version, | 32 int version, |
| 33 const std::string& text, | 33 const std::string& text, |
| 34 int status, | 34 int status, |
| 35 const std::string& response) | 35 const std::string& response) |
| 36 : TestURLFetcher(0, url, d), | 36 : TestURLFetcher(0, url, d), |
| 37 version_(base::StringPrintf("v%d", version)), | 37 version_(base::StringPrintf("v%d", version)), |
| 38 text_(text) { | 38 text_(text) { |
| 39 set_response_code(status); | 39 set_response_code(status); |
| 40 SetResponseString(response); | 40 SetResponseString(response); |
| 41 } | 41 } |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 client_.RequestTextCheck( | 263 client_.RequestTextCheck( |
| 264 &profile_, | 264 &profile_, |
| 265 0, | 265 0, |
| 266 kTests[i].request_type, | 266 kTests[i].request_type, |
| 267 ASCIIToUTF16(kTests[i].request_text), | 267 ASCIIToUTF16(kTests[i].request_text), |
| 268 base::Bind(&SpellingServiceClientTest::OnTextCheckComplete, | 268 base::Bind(&SpellingServiceClientTest::OnTextCheckComplete, |
| 269 base::Unretained(this))); | 269 base::Unretained(this))); |
| 270 client_.CallOnURLFetchComplete(); | 270 client_.CallOnURLFetchComplete(); |
| 271 } | 271 } |
| 272 } | 272 } |
| OLD | NEW |