OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/test/test_webkit_platform_support.h" | 5 #include "content/test/test_webkit_platform_support.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 return blink::WebData(red_square, arraysize(red_square)); | 155 return blink::WebData(red_square, arraysize(red_square)); |
156 } | 156 } |
157 return webkit_glue::WebKitPlatformSupportImpl::loadResource(name); | 157 return webkit_glue::WebKitPlatformSupportImpl::loadResource(name); |
158 } | 158 } |
159 | 159 |
160 blink::WebString TestWebKitPlatformSupport::queryLocalizedString( | 160 blink::WebString TestWebKitPlatformSupport::queryLocalizedString( |
161 blink::WebLocalizedString::Name name) { | 161 blink::WebLocalizedString::Name name) { |
162 // Returns placeholder strings to check if they are correctly localized. | 162 // Returns placeholder strings to check if they are correctly localized. |
163 switch (name) { | 163 switch (name) { |
164 case blink::WebLocalizedString::OtherDateLabel: | 164 case blink::WebLocalizedString::OtherDateLabel: |
165 return ASCIIToUTF16("<<OtherDateLabel>>"); | 165 return base::ASCIIToUTF16("<<OtherDateLabel>>"); |
166 case blink::WebLocalizedString::OtherMonthLabel: | 166 case blink::WebLocalizedString::OtherMonthLabel: |
167 return ASCIIToUTF16("<<OtherMonthLabel>>"); | 167 return base::ASCIIToUTF16("<<OtherMonthLabel>>"); |
168 case blink::WebLocalizedString::OtherTimeLabel: | 168 case blink::WebLocalizedString::OtherTimeLabel: |
169 return ASCIIToUTF16("<<OtherTimeLabel>>"); | 169 return base::ASCIIToUTF16("<<OtherTimeLabel>>"); |
170 case blink::WebLocalizedString::OtherWeekLabel: | 170 case blink::WebLocalizedString::OtherWeekLabel: |
171 return ASCIIToUTF16("<<OtherWeekLabel>>"); | 171 return base::ASCIIToUTF16("<<OtherWeekLabel>>"); |
172 case blink::WebLocalizedString::CalendarClear: | 172 case blink::WebLocalizedString::CalendarClear: |
173 return ASCIIToUTF16("<<CalendarClear>>"); | 173 return base::ASCIIToUTF16("<<CalendarClear>>"); |
174 case blink::WebLocalizedString::CalendarToday: | 174 case blink::WebLocalizedString::CalendarToday: |
175 return ASCIIToUTF16("<<CalendarToday>>"); | 175 return base::ASCIIToUTF16("<<CalendarToday>>"); |
176 case blink::WebLocalizedString::ThisMonthButtonLabel: | 176 case blink::WebLocalizedString::ThisMonthButtonLabel: |
177 return ASCIIToUTF16("<<ThisMonthLabel>>"); | 177 return base::ASCIIToUTF16("<<ThisMonthLabel>>"); |
178 case blink::WebLocalizedString::ThisWeekButtonLabel: | 178 case blink::WebLocalizedString::ThisWeekButtonLabel: |
179 return ASCIIToUTF16("<<ThisWeekLabel>>"); | 179 return base::ASCIIToUTF16("<<ThisWeekLabel>>"); |
180 case blink::WebLocalizedString::WeekFormatTemplate: | 180 case blink::WebLocalizedString::WeekFormatTemplate: |
181 return ASCIIToUTF16("Week $2, $1"); | 181 return base::ASCIIToUTF16("Week $2, $1"); |
182 default: | 182 default: |
183 return WebKitPlatformSupportImpl::queryLocalizedString(name); | 183 return WebKitPlatformSupportImpl::queryLocalizedString(name); |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 blink::WebString TestWebKitPlatformSupport::queryLocalizedString( | 187 blink::WebString TestWebKitPlatformSupport::queryLocalizedString( |
188 blink::WebLocalizedString::Name name, | 188 blink::WebLocalizedString::Name name, |
189 const blink::WebString& value) { | 189 const blink::WebString& value) { |
190 if (name == blink::WebLocalizedString::ValidationRangeUnderflow) | 190 if (name == blink::WebLocalizedString::ValidationRangeUnderflow) |
191 return ASCIIToUTF16("range underflow"); | 191 return base::ASCIIToUTF16("range underflow"); |
192 if (name == blink::WebLocalizedString::ValidationRangeOverflow) | 192 if (name == blink::WebLocalizedString::ValidationRangeOverflow) |
193 return ASCIIToUTF16("range overflow"); | 193 return base::ASCIIToUTF16("range overflow"); |
194 return WebKitPlatformSupportImpl::queryLocalizedString(name, value); | 194 return WebKitPlatformSupportImpl::queryLocalizedString(name, value); |
195 } | 195 } |
196 | 196 |
197 blink::WebString TestWebKitPlatformSupport::queryLocalizedString( | 197 blink::WebString TestWebKitPlatformSupport::queryLocalizedString( |
198 blink::WebLocalizedString::Name name, | 198 blink::WebLocalizedString::Name name, |
199 const blink::WebString& value1, | 199 const blink::WebString& value1, |
200 const blink::WebString& value2) { | 200 const blink::WebString& value2) { |
201 if (name == blink::WebLocalizedString::ValidationTooLong) | 201 if (name == blink::WebLocalizedString::ValidationTooLong) |
202 return ASCIIToUTF16("too long"); | 202 return base::ASCIIToUTF16("too long"); |
203 if (name == blink::WebLocalizedString::ValidationStepMismatch) | 203 if (name == blink::WebLocalizedString::ValidationStepMismatch) |
204 return ASCIIToUTF16("step mismatch"); | 204 return base::ASCIIToUTF16("step mismatch"); |
205 return WebKitPlatformSupportImpl::queryLocalizedString(name, value1, value2); | 205 return WebKitPlatformSupportImpl::queryLocalizedString(name, value1, value2); |
206 } | 206 } |
207 | 207 |
208 blink::WebString TestWebKitPlatformSupport::defaultLocale() { | 208 blink::WebString TestWebKitPlatformSupport::defaultLocale() { |
209 return ASCIIToUTF16("en-US"); | 209 return base::ASCIIToUTF16("en-US"); |
210 } | 210 } |
211 | 211 |
212 #if defined(OS_WIN) || defined(OS_MACOSX) | 212 #if defined(OS_WIN) || defined(OS_MACOSX) |
213 void TestWebKitPlatformSupport::SetThemeEngine(blink::WebThemeEngine* engine) { | 213 void TestWebKitPlatformSupport::SetThemeEngine(blink::WebThemeEngine* engine) { |
214 active_theme_engine_ = engine ? | 214 active_theme_engine_ = engine ? |
215 engine : WebKitPlatformSupportChildImpl::themeEngine(); | 215 engine : WebKitPlatformSupportChildImpl::themeEngine(); |
216 } | 216 } |
217 | 217 |
218 blink::WebThemeEngine* TestWebKitPlatformSupport::themeEngine() { | 218 blink::WebThemeEngine* TestWebKitPlatformSupport::themeEngine() { |
219 return active_theme_engine_; | 219 return active_theme_engine_; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 const blink::WebString& path) { | 317 const blink::WebString& path) { |
318 base::FilePath file_path = base::FilePath::FromUTF16Unsafe(path); | 318 base::FilePath file_path = base::FilePath::FromUTF16Unsafe(path); |
319 | 319 |
320 std::string buffer; | 320 std::string buffer; |
321 base::ReadFileToString(file_path, &buffer); | 321 base::ReadFileToString(file_path, &buffer); |
322 | 322 |
323 return blink::WebData(buffer.data(), buffer.size()); | 323 return blink::WebData(buffer.data(), buffer.size()); |
324 } | 324 } |
325 | 325 |
326 } // namespace content | 326 } // namespace content |
OLD | NEW |