diff options
author | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-16 05:40:41 +0000 |
---|---|---|
committer | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-16 05:40:41 +0000 |
commit | a553b670f031c696a7d8c456d78670e0a0f7db87 (patch) | |
tree | 3ad9502acfa24a6ada8042e1e103ee41b47fd687 /content/shell/common | |
parent | 5273d8ec81d472ed23562968650b304a6874b0d8 (diff) | |
download | chromium_src-a553b670f031c696a7d8c456d78670e0a0f7db87.zip chromium_src-a553b670f031c696a7d8c456d78670e0a0f7db87.tar.gz chromium_src-a553b670f031c696a7d8c456d78670e0a0f7db87.tar.bz2 |
Support sideloaded fonts via command line option for blink layout_tests
Blink side is: https://codereview.chromium.org/235553003/ which
must land and roll first.
Adds support for --register-font-files which adds the given
file(s) to the sandbox policy (readonly), creates and warms up
the font, and passes it to blink.
Also, modify the setup code for layout tests so "Ahem" will be
found correctly.
R=jschuh@chromium.org,eae@chromium.org
BUG=333029
TEST=out\debug\content_shell d:\src\tmp\a.html --enable-direct-write --register-font-files=D:\src\cr3\src\content\shell\renderer\test_runner\resources\fonts\AHEM____.TTF
TEST=ninja -C out\Debug blink_tests && webkit\tools\layout_tests\run_webkit_tests fast/parser/fonts.html --debug --nocheck-sys-deps (with directwrite forced on)
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=263842
Review URL: https://codereview.chromium.org/231763003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264126 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell/common')
-rw-r--r-- | content/shell/common/shell_switches.cc | 7 | ||||
-rw-r--r-- | content/shell/common/shell_switches.h | 1 | ||||
-rw-r--r-- | content/shell/common/webkit_test_helpers.cc | 13 | ||||
-rw-r--r-- | content/shell/common/webkit_test_helpers.h | 6 |
4 files changed, 26 insertions, 1 deletions
diff --git a/content/shell/common/shell_switches.cc b/content/shell/common/shell_switches.cc index bd308b7..997981e 100644 --- a/content/shell/common/shell_switches.cc +++ b/content/shell/common/shell_switches.cc @@ -39,7 +39,12 @@ const char kEncodeBinary[] = "encode-binary"; // Exposes the window.internals object to JavaScript for interactive development // and debugging of layout tests that rely on it. -const char kExposeInternalsForTesting[] = "expose-internals-for-testing"; +const char kExposeInternalsForTesting[] = "expose-internals-for-testing"; + +// Registers additional font files on Windows (for fonts outside the usual +// %WINDIR%\Fonts location). Multiple files can be used by separating them +// with a semicolon (;). +const char kRegisterFontFiles[] = "register-font-files"; // This makes us disable some web-platform runtime features so that we test // content_shell as if it was a stable release. It is only followed when diff --git a/content/shell/common/shell_switches.h b/content/shell/common/shell_switches.h index 30869fb..fb830f2 100644 --- a/content/shell/common/shell_switches.h +++ b/content/shell/common/shell_switches.h @@ -20,6 +20,7 @@ extern const char kEnableFontSmoothing[]; extern const char kEnableLeakDetection[]; extern const char kEncodeBinary[]; extern const char kExposeInternalsForTesting[]; +extern const char kRegisterFontFiles[]; extern const char kStableReleaseMode[]; } // namespace switches diff --git a/content/shell/common/webkit_test_helpers.cc b/content/shell/common/webkit_test_helpers.cc index d2c1ea1..5c0cf3d 100644 --- a/content/shell/common/webkit_test_helpers.cc +++ b/content/shell/common/webkit_test_helpers.cc @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/file_util.h" #include "base/path_service.h" +#include "base/strings/string_split.h" #include "base/strings/utf_string_conversions.h" #include "content/public/common/content_switches.h" #include "content/shell/common/shell_switches.h" @@ -118,4 +119,16 @@ base::FilePath GetWebKitRootDirFilePath() { return base_path.Append(FILE_PATH_LITERAL("third_party/WebKit")); } +std::vector<std::string> GetSideloadFontFiles() { + std::vector<std::string> files; + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + if (command_line.HasSwitch(switches::kRegisterFontFiles)) { + base::SplitString( + command_line.GetSwitchValueASCII(switches::kRegisterFontFiles), + ';', + &files); + } + return files; +} + } // namespace content diff --git a/content/shell/common/webkit_test_helpers.h b/content/shell/common/webkit_test_helpers.h index 0d4593f..ffdbb2d 100644 --- a/content/shell/common/webkit_test_helpers.h +++ b/content/shell/common/webkit_test_helpers.h @@ -5,6 +5,9 @@ #ifndef CONTENT_SHELL_COMMON_WEBKIT_TEST_HELPERS_H_ #define CONTENT_SHELL_COMMON_WEBKIT_TEST_HELPERS_H_ +#include <string> +#include <vector> + struct WebPreferences; namespace base { @@ -30,6 +33,9 @@ void ApplyLayoutTestDefaultPreferences(WebPreferences* prefs); // Returns the root of the Blink checkout. base::FilePath GetWebKitRootDirFilePath(); +// Returns list of extra font files to be made accessible to the renderer. +std::vector<std::string> GetSideloadFontFiles(); + } // namespace content #endif // CONTENT_SHELL_COMMON_WEBKIT_TEST_HELPERS_H_ |