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