Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: webkit/tools/test_shell/test_shell.cc

Issue 10107014: Migrate WebKit "global script" font prefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix after sync Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« webkit/glue/webpreferences.cc ('K') | « webkit/glue/webpreferences.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
viettrungluu 2012/05/16 13:27:58 "
falken 2012/05/17 07:08:41 Removed this as now it uses WebPreferences::kCommo
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 74
73 // Content area size for newly created windows. 75 // Content area size for newly created windows.
74 const int kTestWindowWidth = 800; 76 const int kTestWindowWidth = 800;
75 const int kTestWindowHeight = 600; 77 const int kTestWindowHeight = 600;
76 78
77 // The W3C SVG layout tests use a different size than the other layout 79 // The W3C SVG layout tests use a different size than the other layout
78 // tests. 80 // tests.
79 const int kSVGTestWindowWidth = 480; 81 const int kSVGTestWindowWidth = 480;
80 const int kSVGTestWindowHeight = 360; 82 const int kSVGTestWindowHeight = 360;
81 83
84 const char* kCommonScript = uscript_getShortName(USCRIPT_COMMON);
viettrungluu 2012/05/16 13:27:58 " (even if no one cares about test_shell)
falken 2012/05/17 07:08:41 Done.
85
82 // URLRequestTestShellFileJob is used to serve the inspector 86 // URLRequestTestShellFileJob is used to serve the inspector
83 class URLRequestTestShellFileJob : public net::URLRequestFileJob { 87 class URLRequestTestShellFileJob : public net::URLRequestFileJob {
84 public: 88 public:
85 static net::URLRequestJob* InspectorFactory(net::URLRequest* request, 89 static net::URLRequestJob* InspectorFactory(net::URLRequest* request,
86 const std::string& scheme) { 90 const std::string& scheme) {
87 FilePath path; 91 FilePath path;
88 PathService::Get(base::DIR_EXE, &path); 92 PathService::Get(base::DIR_EXE, &path);
89 path = path.AppendASCII("resources"); 93 path = path.AppendASCII("resources");
90 path = path.AppendASCII("inspector"); 94 path = path.AppendASCII("inspector");
91 path = path.AppendASCII(request->url().path().substr(1)); 95 path = path.AppendASCII(request->url().path().substr(1));
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // static 298 // static
295 void TestShell::ResetWebPreferences() { 299 void TestShell::ResetWebPreferences() {
296 DCHECK(web_prefs_); 300 DCHECK(web_prefs_);
297 301
298 // Match the settings used by Mac DumpRenderTree, with the exception of 302 // Match the settings used by Mac DumpRenderTree, with the exception of
299 // fonts. 303 // fonts.
300 if (web_prefs_) { 304 if (web_prefs_) {
301 *web_prefs_ = WebPreferences(); 305 *web_prefs_ = WebPreferences();
302 306
303 #if defined(OS_MACOSX) 307 #if defined(OS_MACOSX)
304 web_prefs_->serif_font_family = ASCIIToUTF16("Times"); 308 web_prefs_->serif_font_family_map[kCommonScript] =
305 web_prefs_->cursive_font_family = ASCIIToUTF16("Apple Chancery"); 309 ASCIIToUTF16("Times");
306 web_prefs_->fantasy_font_family = ASCIIToUTF16("Papyrus"); 310 web_prefs_->cursive_font_family_map[kCommonScript] =
311 ASCIIToUTF16("Apple Chancery");
312 web_prefs_->fantasy_font_family_map[kCommonScript] =
313 ASCIIToUTF16("Papyrus");
307 #else 314 #else
308 // NOTE: case matters here, this must be 'times new roman', else 315 // NOTE: case matters here, this must be 'times new roman', else
309 // some layout tests fail. 316 // some layout tests fail.
310 web_prefs_->serif_font_family = ASCIIToUTF16("times new roman"); 317 web_prefs_->serif_font_family_map[kCommonScript] =
318 ASCIIToUTF16("times new roman");
311 319
312 // These two fonts are picked from the intersection of 320 // These two fonts are picked from the intersection of
313 // Win XP font list and Vista font list : 321 // Win XP font list and Vista font list :
314 // http://www.microsoft.com/typography/fonts/winxp.htm 322 // http://www.microsoft.com/typography/fonts/winxp.htm
315 // http://blogs.msdn.com/michkap/archive/2006/04/04/567881.aspx 323 // http://blogs.msdn.com/michkap/archive/2006/04/04/567881.aspx
316 // Some of them are installed only with CJK and complex script 324 // Some of them are installed only with CJK and complex script
317 // support enabled on Windows XP and are out of consideration here. 325 // support enabled on Windows XP and are out of consideration here.
318 // (although we enabled both on our buildbots.) 326 // (although we enabled both on our buildbots.)
319 // They (especially Impact for fantasy) are not typical cursive 327 // They (especially Impact for fantasy) are not typical cursive
320 // and fantasy fonts, but it should not matter for layout tests 328 // and fantasy fonts, but it should not matter for layout tests
321 // as long as they're available. 329 // as long as they're available.
322 web_prefs_->cursive_font_family = ASCIIToUTF16("Comic Sans MS"); 330 web_prefs_->cursive_font_family_map[kCommonScript] =
323 web_prefs_->fantasy_font_family = ASCIIToUTF16("Impact"); 331 ASCIIToUTF16("Comic Sans MS");
332 web_prefs_->fantasy_font_family_map[kCommonScript] =
333 ASCIIToUTF16("Impact");
324 #endif 334 #endif
325 web_prefs_->standard_font_family = web_prefs_->serif_font_family; 335 web_prefs_->standard_font_family_map[kCommonScript] =
326 web_prefs_->fixed_font_family = ASCIIToUTF16("Courier"); 336 web_prefs_->serif_font_family_map[kCommonScript];
327 web_prefs_->sans_serif_font_family = ASCIIToUTF16("Helvetica"); 337 web_prefs_->fixed_font_family_map[kCommonScript] =
338 ASCIIToUTF16("Courier");
339 web_prefs_->sans_serif_font_family_map[kCommonScript] =
340 ASCIIToUTF16("Helvetica");
328 341
329 web_prefs_->default_encoding = "ISO-8859-1"; 342 web_prefs_->default_encoding = "ISO-8859-1";
330 web_prefs_->default_font_size = 16; 343 web_prefs_->default_font_size = 16;
331 web_prefs_->default_fixed_font_size = 13; 344 web_prefs_->default_fixed_font_size = 13;
332 web_prefs_->minimum_font_size = 0; 345 web_prefs_->minimum_font_size = 0;
333 web_prefs_->minimum_logical_font_size = 9; 346 web_prefs_->minimum_logical_font_size = 9;
334 web_prefs_->javascript_can_open_windows_automatically = true; 347 web_prefs_->javascript_can_open_windows_automatically = true;
335 web_prefs_->dom_paste_enabled = true; 348 web_prefs_->dom_paste_enabled = true;
336 web_prefs_->developer_extras_enabled = !layout_test_mode_ || 349 web_prefs_->developer_extras_enabled = !layout_test_mode_ ||
337 developer_extras_enabled_; 350 developer_extras_enabled_;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 return device_orientation_client_mock_.get(); 619 return device_orientation_client_mock_.get();
607 } 620 }
608 621
609 WebKit::WebGeolocationClientMock* TestShell::geolocation_client_mock() { 622 WebKit::WebGeolocationClientMock* TestShell::geolocation_client_mock() {
610 if (!geolocation_client_mock_.get()) { 623 if (!geolocation_client_mock_.get()) {
611 geolocation_client_mock_.reset( 624 geolocation_client_mock_.reset(
612 WebKit::WebGeolocationClientMock::create()); 625 WebKit::WebGeolocationClientMock::create());
613 } 626 }
614 return geolocation_client_mock_.get(); 627 return geolocation_client_mock_.get();
615 } 628 }
OLDNEW
« webkit/glue/webpreferences.cc ('K') | « webkit/glue/webpreferences.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698