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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 EXPECT_EQ(success_, success); | 124 EXPECT_EQ(success_, success); |
125 string16 text(UTF8ToUTF16(request_text_)); | 125 string16 text(UTF8ToUTF16(request_text_)); |
126 for (std::vector<SpellCheckResult>::const_iterator it = results.begin(); | 126 for (std::vector<SpellCheckResult>::const_iterator it = results.begin(); |
127 it != results.end(); ++it) { | 127 it != results.end(); ++it) { |
128 text.replace(it->location, it->length, it->replacement); | 128 text.replace(it->location, it->length, it->replacement); |
129 } | 129 } |
130 EXPECT_EQ(corrected_text_, text); | 130 EXPECT_EQ(corrected_text_, text); |
131 } | 131 } |
132 | 132 |
133 private: | 133 private: |
134 virtual content::URLFetcher* CreateURLFetcher(const GURL& url) { | 134 virtual net::URLFetcher* CreateURLFetcher(const GURL& url) { |
135 EXPECT_EQ("https://www.googleapis.com/rpc", url.spec()); | 135 EXPECT_EQ("https://www.googleapis.com/rpc", url.spec()); |
136 fetcher_ = new TestSpellingURLFetcher(0, url, this, | 136 fetcher_ = new TestSpellingURLFetcher(0, url, this, |
137 request_type_, request_text_, | 137 request_type_, request_text_, |
138 response_status_, response_data_); | 138 response_status_, response_data_); |
139 return fetcher_; | 139 return fetcher_; |
140 } | 140 } |
141 | 141 |
142 int request_type_; | 142 int request_type_; |
143 std::string request_text_; | 143 std::string request_text_; |
144 int response_status_; | 144 int response_status_; |
(...skipping 118 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 |