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_blink_web_unit_test_support.h" | 5 #include "content/test/test_blink_web_unit_test_support.h" |
6 | 6 |
7 #include "base/feature_list.h" | 7 #include "base/feature_list.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 blink::WebURLLoader* TestBlinkWebUnitTestSupport::createURLLoader() { | 187 blink::WebURLLoader* TestBlinkWebUnitTestSupport::createURLLoader() { |
188 return url_loader_factory_->createURLLoader( | 188 return url_loader_factory_->createURLLoader( |
189 BlinkPlatformImpl::createURLLoader()); | 189 BlinkPlatformImpl::createURLLoader()); |
190 } | 190 } |
191 | 191 |
192 blink::WebString TestBlinkWebUnitTestSupport::userAgent() { | 192 blink::WebString TestBlinkWebUnitTestSupport::userAgent() { |
193 return blink::WebString::fromUTF8("test_runner/0.0.0.0"); | 193 return blink::WebString::fromUTF8("test_runner/0.0.0.0"); |
194 } | 194 } |
195 | 195 |
196 blink::WebData TestBlinkWebUnitTestSupport::loadResource(const char* name) { | |
197 if (!strcmp(name, "deleteButton")) { | |
198 // Create a red 30x30 square. | |
199 const char red_square[] = | |
200 "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52" | |
201 "\x00\x00\x00\x1e\x00\x00\x00\x1e\x04\x03\x00\x00\x00\xc9\x1e\xb3" | |
202 "\x91\x00\x00\x00\x30\x50\x4c\x54\x45\x00\x00\x00\x80\x00\x00\x00" | |
203 "\x80\x00\x80\x80\x00\x00\x00\x80\x80\x00\x80\x00\x80\x80\x80\x80" | |
204 "\x80\xc0\xc0\xc0\xff\x00\x00\x00\xff\x00\xff\xff\x00\x00\x00\xff" | |
205 "\xff\x00\xff\x00\xff\xff\xff\xff\xff\x7b\x1f\xb1\xc4\x00\x00\x00" | |
206 "\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a" | |
207 "\x9c\x18\x00\x00\x00\x17\x49\x44\x41\x54\x78\x01\x63\x98\x89\x0a" | |
208 "\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d" | |
209 "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60" | |
210 "\x82"; | |
211 return blink::WebData(red_square, arraysize(red_square)); | |
212 } | |
213 return BlinkPlatformImpl::loadResource(name); | |
214 } | |
215 | |
216 blink::WebString TestBlinkWebUnitTestSupport::queryLocalizedString( | 196 blink::WebString TestBlinkWebUnitTestSupport::queryLocalizedString( |
217 blink::WebLocalizedString::Name name) { | 197 blink::WebLocalizedString::Name name) { |
218 // Returns placeholder strings to check if they are correctly localized. | 198 // Returns placeholder strings to check if they are correctly localized. |
219 switch (name) { | 199 switch (name) { |
220 case blink::WebLocalizedString::OtherDateLabel: | 200 case blink::WebLocalizedString::OtherDateLabel: |
221 return base::ASCIIToUTF16("<<OtherDateLabel>>"); | 201 return base::ASCIIToUTF16("<<OtherDateLabel>>"); |
222 case blink::WebLocalizedString::OtherMonthLabel: | 202 case blink::WebLocalizedString::OtherMonthLabel: |
223 return base::ASCIIToUTF16("<<OtherMonthLabel>>"); | 203 return base::ASCIIToUTF16("<<OtherMonthLabel>>"); |
224 case blink::WebLocalizedString::OtherTimeLabel: | 204 case blink::WebLocalizedString::OtherTimeLabel: |
225 return base::ASCIIToUTF16("<<OtherTimeLabel>>"); | 205 return base::ASCIIToUTF16("<<OtherTimeLabel>>"); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 return BlinkPlatformImpl::currentThread(); | 285 return BlinkPlatformImpl::currentThread(); |
306 } | 286 } |
307 | 287 |
308 void TestBlinkWebUnitTestSupport::getPluginList( | 288 void TestBlinkWebUnitTestSupport::getPluginList( |
309 bool refresh, blink::WebPluginListBuilder* builder) { | 289 bool refresh, blink::WebPluginListBuilder* builder) { |
310 builder->addPlugin("pdf", "pdf", "pdf-files"); | 290 builder->addPlugin("pdf", "pdf", "pdf-files"); |
311 builder->addMediaTypeToLastPlugin("application/pdf", "pdf"); | 291 builder->addMediaTypeToLastPlugin("application/pdf", "pdf"); |
312 } | 292 } |
313 | 293 |
314 } // namespace content | 294 } // namespace content |
OLD | NEW |