diff options
author | tkent@google.com <tkent@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-16 02:11:29 +0000 |
---|---|---|
committer | tkent@google.com <tkent@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-16 02:11:29 +0000 |
commit | 6c23230f2e2b345a7fafb4caf814e07b8228cae7 (patch) | |
tree | c809b1656d8d88f66726cc7a7d113c0940426ebd /webkit/support | |
parent | 12bb682a916f1fde517fbee8fc7cdcf7cdede878 (diff) | |
download | chromium_src-6c23230f2e2b345a7fafb4caf814e07b8228cae7.zip chromium_src-6c23230f2e2b345a7fafb4caf814e07b8228cae7.tar.gz chromium_src-6c23230f2e2b345a7fafb4caf814e07b8228cae7.tar.bz2 |
Add webkit_support::SetCurrentDirectoryForFileURL(const WebURL&).
It is used to set the current working directory for every layout
tests. Some tests refer to local files with relative paths.
See http://src.chromium.org/viewvc/chrome?view=rev&revision=25257
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2822008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49886 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support')
-rw-r--r-- | webkit/support/webkit_support.cc | 6 | ||||
-rw-r--r-- | webkit/support/webkit_support.h | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index e68e021..1c98384 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -304,6 +304,12 @@ WebURL RewriteLayoutTestsURL(const std::string& utf8_url) { return WebURL(GURL(newUrl)); } +bool SetCurrentDirectoryForFileURL(const WebKit::WebURL& fileUrl) { + FilePath localPath; + return net::FileURLToFilePath(fileUrl, &localPath) + && file_util::SetCurrentDirectory(localPath.DirName()); +} + // Bridge for SimpleDatabaseSystem void SetDatabaseQuota(int quota) { diff --git a/webkit/support/webkit_support.h b/webkit/support/webkit_support.h index 179c5c1..c6dfc35 100644 --- a/webkit/support/webkit_support.h +++ b/webkit/support/webkit_support.h @@ -91,6 +91,9 @@ WebKit::WebURL CreateURLForPathOrURL( // Converts file:///tmp/LayoutTests URLs to the actual location on disk. WebKit::WebURL RewriteLayoutTestsURL(const std::string& utf8_url); +// Set the directory of specified file: URL as the current working directory. +bool SetCurrentDirectoryForFileURL(const WebKit::WebURL& fileUrl); + // - Database void SetDatabaseQuota(int quota); void ClearAllDatabases(); |