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" |
11 #include "base/metrics/stats_counters.h" | 11 #include "base/metrics/stats_counters.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
| 15 #include "content/public/test/test_content_client_initializer.h" |
15 #include "content/test/mock_webclipboard_impl.h" | 16 #include "content/test/mock_webclipboard_impl.h" |
16 #include "content/test/web_gesture_curve_mock.h" | 17 #include "content/test/web_gesture_curve_mock.h" |
17 #include "content/test/web_layer_tree_view_impl_for_testing.h" | 18 #include "content/test/web_layer_tree_view_impl_for_testing.h" |
18 #include "content/test/weburl_loader_mock_factory.h" | 19 #include "content/test/weburl_loader_mock_factory.h" |
19 #include "media/base/media.h" | 20 #include "media/base/media.h" |
20 #include "net/cookies/cookie_monster.h" | 21 #include "net/cookies/cookie_monster.h" |
21 #include "net/test/spawned_test_server/spawned_test_server.h" | 22 #include "net/test/spawned_test_server/spawned_test_server.h" |
22 #include "third_party/WebKit/public/platform/WebData.h" | 23 #include "third_party/WebKit/public/platform/WebData.h" |
23 #include "third_party/WebKit/public/platform/WebFileSystem.h" | 24 #include "third_party/WebKit/public/platform/WebFileSystem.h" |
24 #include "third_party/WebKit/public/platform/WebStorageArea.h" | 25 #include "third_party/WebKit/public/platform/WebStorageArea.h" |
(...skipping 22 matching lines...) Expand all Loading... |
47 | 48 |
48 url_loader_factory_.reset(new WebURLLoaderMockFactory()); | 49 url_loader_factory_.reset(new WebURLLoaderMockFactory()); |
49 mock_clipboard_.reset(new MockWebClipboardImpl()); | 50 mock_clipboard_.reset(new MockWebClipboardImpl()); |
50 | 51 |
51 // Create an anonymous stats table since we don't need to share between | 52 // Create an anonymous stats table since we don't need to share between |
52 // processes. | 53 // processes. |
53 stats_table_.reset( | 54 stats_table_.reset( |
54 new base::StatsTable(base::StatsTable::TableIdentifier(), 20, 200)); | 55 new base::StatsTable(base::StatsTable::TableIdentifier(), 20, 200)); |
55 base::StatsTable::set_current(stats_table_.get()); | 56 base::StatsTable::set_current(stats_table_.get()); |
56 | 57 |
| 58 content_initializer_.reset(new content::TestContentClientInitializer()); |
| 59 |
57 blink::initialize(this); | 60 blink::initialize(this); |
58 blink::mainThreadIsolate()->SetCounterFunction( | 61 blink::mainThreadIsolate()->SetCounterFunction( |
59 base::StatsTable::FindLocation); | 62 base::StatsTable::FindLocation); |
60 blink::setLayoutTestMode(true); | 63 blink::setLayoutTestMode(true); |
61 blink::WebSecurityPolicy::registerURLSchemeAsLocal( | 64 blink::WebSecurityPolicy::registerURLSchemeAsLocal( |
62 blink::WebString::fromUTF8("test-shell-resource")); | 65 blink::WebString::fromUTF8("test-shell-resource")); |
63 blink::WebSecurityPolicy::registerURLSchemeAsNoAccess( | 66 blink::WebSecurityPolicy::registerURLSchemeAsNoAccess( |
64 blink::WebString::fromUTF8("test-shell-resource")); | 67 blink::WebString::fromUTF8("test-shell-resource")); |
65 blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated( | 68 blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated( |
66 blink::WebString::fromUTF8("test-shell-resource")); | 69 blink::WebString::fromUTF8("test-shell-resource")); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 "\x80\x00\x80\x80\x00\x00\x00\x80\x80\x00\x80\x00\x80\x80\x80\x80" | 159 "\x80\x00\x80\x80\x00\x00\x00\x80\x80\x00\x80\x00\x80\x80\x80\x80" |
157 "\x80\xc0\xc0\xc0\xff\x00\x00\x00\xff\x00\xff\xff\x00\x00\x00\xff" | 160 "\x80\xc0\xc0\xc0\xff\x00\x00\x00\xff\x00\xff\xff\x00\x00\x00\xff" |
158 "\xff\x00\xff\x00\xff\xff\xff\xff\xff\x7b\x1f\xb1\xc4\x00\x00\x00" | 161 "\xff\x00\xff\x00\xff\xff\xff\xff\xff\x7b\x1f\xb1\xc4\x00\x00\x00" |
159 "\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a" | 162 "\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a" |
160 "\x9c\x18\x00\x00\x00\x17\x49\x44\x41\x54\x78\x01\x63\x98\x89\x0a" | 163 "\x9c\x18\x00\x00\x00\x17\x49\x44\x41\x54\x78\x01\x63\x98\x89\x0a" |
161 "\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d" | 164 "\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d" |
162 "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60" | 165 "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60" |
163 "\x82"; | 166 "\x82"; |
164 return blink::WebData(red_square, arraysize(red_square)); | 167 return blink::WebData(red_square, arraysize(red_square)); |
165 } | 168 } |
166 return blink::WebData(); | 169 return BlinkPlatformImpl::loadResource(name); |
167 } | 170 } |
168 | 171 |
169 blink::WebString TestWebKitPlatformSupport::queryLocalizedString( | 172 blink::WebString TestWebKitPlatformSupport::queryLocalizedString( |
170 blink::WebLocalizedString::Name name) { | 173 blink::WebLocalizedString::Name name) { |
171 // Returns placeholder strings to check if they are correctly localized. | 174 // Returns placeholder strings to check if they are correctly localized. |
172 switch (name) { | 175 switch (name) { |
173 case blink::WebLocalizedString::OtherDateLabel: | 176 case blink::WebLocalizedString::OtherDateLabel: |
174 return base::ASCIIToUTF16("<<OtherDateLabel>>"); | 177 return base::ASCIIToUTF16("<<OtherDateLabel>>"); |
175 case blink::WebLocalizedString::OtherMonthLabel: | 178 case blink::WebLocalizedString::OtherMonthLabel: |
176 return base::ASCIIToUTF16("<<OtherMonthLabel>>"); | 179 return base::ASCIIToUTF16("<<OtherMonthLabel>>"); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 const blink::WebString& path) { | 297 const blink::WebString& path) { |
295 base::FilePath file_path = base::FilePath::FromUTF16Unsafe(path); | 298 base::FilePath file_path = base::FilePath::FromUTF16Unsafe(path); |
296 | 299 |
297 std::string buffer; | 300 std::string buffer; |
298 base::ReadFileToString(file_path, &buffer); | 301 base::ReadFileToString(file_path, &buffer); |
299 | 302 |
300 return blink::WebData(buffer.data(), buffer.size()); | 303 return blink::WebData(buffer.data(), buffer.size()); |
301 } | 304 } |
302 | 305 |
303 } // namespace content | 306 } // namespace content |
OLD | NEW |