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 #undef LOG | 5 #undef LOG |
6 | 6 |
7 #include "webkit/tools/test_shell/test_shell.h" | 7 #include "webkit/tools/test_shell/test_shell.h" |
8 | 8 |
| 9 #include <unicode/uscript.h> |
| 10 |
9 #include "base/base_paths.h" | 11 #include "base/base_paths.h" |
10 #include "base/command_line.h" | 12 #include "base/command_line.h" |
11 #include "base/debug/debug_on_start_win.h" | 13 #include "base/debug/debug_on_start_win.h" |
12 #include "base/file_path.h" | 14 #include "base/file_path.h" |
13 #include "base/file_util.h" | 15 #include "base/file_util.h" |
14 #include "base/md5.h" | 16 #include "base/md5.h" |
15 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
16 #include "base/metrics/stats_table.h" | 18 #include "base/metrics/stats_table.h" |
17 #include "base/path_service.h" | 19 #include "base/path_service.h" |
18 #include "base/string_util.h" | 20 #include "base/string_util.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 73 |
72 // Content area size for newly created windows. | 74 // Content area size for newly created windows. |
73 const int kTestWindowWidth = 800; | 75 const int kTestWindowWidth = 800; |
74 const int kTestWindowHeight = 600; | 76 const int kTestWindowHeight = 600; |
75 | 77 |
76 // The W3C SVG layout tests use a different size than the other layout | 78 // The W3C SVG layout tests use a different size than the other layout |
77 // tests. | 79 // tests. |
78 const int kSVGTestWindowWidth = 480; | 80 const int kSVGTestWindowWidth = 480; |
79 const int kSVGTestWindowHeight = 360; | 81 const int kSVGTestWindowHeight = 360; |
80 | 82 |
| 83 const char* kCommonScript = uscript_getShortName(USCRIPT_COMMON); |
| 84 |
81 // URLRequestTestShellFileJob is used to serve the inspector | 85 // URLRequestTestShellFileJob is used to serve the inspector |
82 class URLRequestTestShellFileJob : public net::URLRequestFileJob { | 86 class URLRequestTestShellFileJob : public net::URLRequestFileJob { |
83 public: | 87 public: |
84 static net::URLRequestJob* InspectorFactory(net::URLRequest* request, | 88 static net::URLRequestJob* InspectorFactory(net::URLRequest* request, |
85 const std::string& scheme) { | 89 const std::string& scheme) { |
86 FilePath path; | 90 FilePath path; |
87 PathService::Get(base::DIR_EXE, &path); | 91 PathService::Get(base::DIR_EXE, &path); |
88 path = path.AppendASCII("resources"); | 92 path = path.AppendASCII("resources"); |
89 path = path.AppendASCII("inspector"); | 93 path = path.AppendASCII("inspector"); |
90 path = path.AppendASCII(request->url().path().substr(1)); | 94 path = path.AppendASCII(request->url().path().substr(1)); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 // static | 297 // static |
294 void TestShell::ResetWebPreferences() { | 298 void TestShell::ResetWebPreferences() { |
295 DCHECK(web_prefs_); | 299 DCHECK(web_prefs_); |
296 | 300 |
297 // Match the settings used by Mac DumpRenderTree, with the exception of | 301 // Match the settings used by Mac DumpRenderTree, with the exception of |
298 // fonts. | 302 // fonts. |
299 if (web_prefs_) { | 303 if (web_prefs_) { |
300 *web_prefs_ = WebPreferences(); | 304 *web_prefs_ = WebPreferences(); |
301 | 305 |
302 #if defined(OS_MACOSX) | 306 #if defined(OS_MACOSX) |
303 web_prefs_->serif_font_family = ASCIIToUTF16("Times"); | 307 web_prefs_->serif_font_family_map[kCommonScript] = |
304 web_prefs_->cursive_font_family = ASCIIToUTF16("Apple Chancery"); | 308 ASCIIToUTF16("Times"); |
305 web_prefs_->fantasy_font_family = ASCIIToUTF16("Papyrus"); | 309 web_prefs_->cursive_font_family_map[kCommonScript] = |
| 310 ASCIIToUTF16("Apple Chancery"); |
| 311 web_prefs_->fantasy_font_family_map[kCommonScript] = |
| 312 ASCIIToUTF16("Papyrus"); |
306 #else | 313 #else |
307 // NOTE: case matters here, this must be 'times new roman', else | 314 // NOTE: case matters here, this must be 'times new roman', else |
308 // some layout tests fail. | 315 // some layout tests fail. |
309 web_prefs_->serif_font_family = ASCIIToUTF16("times new roman"); | 316 web_prefs_->serif_font_family_map[kCommonScript] = |
| 317 ASCIIToUTF16("times new roman"); |
310 | 318 |
311 // These two fonts are picked from the intersection of | 319 // These two fonts are picked from the intersection of |
312 // Win XP font list and Vista font list : | 320 // Win XP font list and Vista font list : |
313 // http://www.microsoft.com/typography/fonts/winxp.htm | 321 // http://www.microsoft.com/typography/fonts/winxp.htm |
314 // http://blogs.msdn.com/michkap/archive/2006/04/04/567881.aspx | 322 // http://blogs.msdn.com/michkap/archive/2006/04/04/567881.aspx |
315 // Some of them are installed only with CJK and complex script | 323 // Some of them are installed only with CJK and complex script |
316 // support enabled on Windows XP and are out of consideration here. | 324 // support enabled on Windows XP and are out of consideration here. |
317 // (although we enabled both on our buildbots.) | 325 // (although we enabled both on our buildbots.) |
318 // They (especially Impact for fantasy) are not typical cursive | 326 // They (especially Impact for fantasy) are not typical cursive |
319 // and fantasy fonts, but it should not matter for layout tests | 327 // and fantasy fonts, but it should not matter for layout tests |
320 // as long as they're available. | 328 // as long as they're available. |
321 web_prefs_->cursive_font_family = ASCIIToUTF16("Comic Sans MS"); | 329 web_prefs_->cursive_font_family_map[kCommonScript] = |
322 web_prefs_->fantasy_font_family = ASCIIToUTF16("Impact"); | 330 ASCIIToUTF16("Comic Sans MS"); |
| 331 web_prefs_->fantasy_font_family_map[kCommonScript] = |
| 332 ASCIIToUTF16("Impact"); |
323 #endif | 333 #endif |
324 web_prefs_->standard_font_family = web_prefs_->serif_font_family; | 334 web_prefs_->standard_font_family_map[kCommonScript] = |
325 web_prefs_->fixed_font_family = ASCIIToUTF16("Courier"); | 335 web_prefs_->serif_font_family_map[kCommonScript]; |
326 web_prefs_->sans_serif_font_family = ASCIIToUTF16("Helvetica"); | 336 web_prefs_->fixed_font_family_map[kCommonScript] = |
| 337 ASCIIToUTF16("Courier"); |
| 338 web_prefs_->sans_serif_font_family_map[kCommonScript] = |
| 339 ASCIIToUTF16("Helvetica"); |
327 | 340 |
328 web_prefs_->default_encoding = "ISO-8859-1"; | 341 web_prefs_->default_encoding = "ISO-8859-1"; |
329 web_prefs_->default_font_size = 16; | 342 web_prefs_->default_font_size = 16; |
330 web_prefs_->default_fixed_font_size = 13; | 343 web_prefs_->default_fixed_font_size = 13; |
331 web_prefs_->minimum_font_size = 0; | 344 web_prefs_->minimum_font_size = 0; |
332 web_prefs_->minimum_logical_font_size = 9; | 345 web_prefs_->minimum_logical_font_size = 9; |
333 web_prefs_->javascript_can_open_windows_automatically = true; | 346 web_prefs_->javascript_can_open_windows_automatically = true; |
334 web_prefs_->dom_paste_enabled = true; | 347 web_prefs_->dom_paste_enabled = true; |
335 web_prefs_->developer_extras_enabled = !layout_test_mode_ || | 348 web_prefs_->developer_extras_enabled = !layout_test_mode_ || |
336 developer_extras_enabled_; | 349 developer_extras_enabled_; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 return device_orientation_client_mock_.get(); | 618 return device_orientation_client_mock_.get(); |
606 } | 619 } |
607 | 620 |
608 WebKit::WebGeolocationClientMock* TestShell::geolocation_client_mock() { | 621 WebKit::WebGeolocationClientMock* TestShell::geolocation_client_mock() { |
609 if (!geolocation_client_mock_.get()) { | 622 if (!geolocation_client_mock_.get()) { |
610 geolocation_client_mock_.reset( | 623 geolocation_client_mock_.reset( |
611 WebKit::WebGeolocationClientMock::create()); | 624 WebKit::WebGeolocationClientMock::create()); |
612 } | 625 } |
613 return geolocation_client_mock_.get(); | 626 return geolocation_client_mock_.get(); |
614 } | 627 } |
OLD | NEW |