diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-06 21:41:06 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-06 21:41:06 +0000 |
commit | ea6e6cf0f3aa1e0ec2ea9ddbbebbb272e9bbc019 (patch) | |
tree | 12b2ccd788a66bff01b816bf7c792e349f21920d /webkit/tools/test_shell/test_shell_gtk.cc | |
parent | e6da7c850491960c5fe7dcf737db19d49c00784d (diff) | |
download | chromium_src-ea6e6cf0f3aa1e0ec2ea9ddbbebbb272e9bbc019.zip chromium_src-ea6e6cf0f3aa1e0ec2ea9ddbbebbb272e9bbc019.tar.gz chromium_src-ea6e6cf0f3aa1e0ec2ea9ddbbebbb272e9bbc019.tar.bz2 |
Prepend protocol on file URLs in test shell gtk.
Review URL: http://codereview.chromium.org/9624
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4915 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/test_shell_gtk.cc')
-rw-r--r-- | webkit/tools/test_shell/test_shell_gtk.cc | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc index 2fb2d2c..ee3c6ed 100644 --- a/webkit/tools/test_shell/test_shell_gtk.cc +++ b/webkit/tools/test_shell/test_shell_gtk.cc @@ -15,6 +15,7 @@ #include "base/path_service.h" #include "base/string_util.h" #include "net/base/mime_util.h" +#include "net/base/net_util.h" #include "webkit/glue/plugins/plugin_list.h" #include "webkit/glue/resource_loader_bridge.h" #include "webkit/glue/webdatasource.h" @@ -335,18 +336,26 @@ void TestShell::ResizeSubViews() { void TestShell::LoadURLForFrame(const wchar_t* url, const wchar_t* frame_name) { - if (!url) - return; + if (!url) + return; + + std::wstring frame_string; + if (frame_name) + frame_string = frame_name; - std::wstring frame_string; - if (frame_name) - frame_string = frame_name; + LOG(INFO) << "Loading " << WideToUTF8(url) << " in frame '" + << WideToUTF8(frame_string) << "'"; - LOG(INFO) << "Loading " << WideToUTF8(url) << " in frame '" - << WideToUTF8(frame_string) << "'"; + GURL gurl; + // PathExists will reject any string with no leading '/' + // as well as empty strings. + if (file_util::PathExists(url)) + gurl = net::FilePathToFileURL(url); + else + gurl = GURL(WideToUTF8(url)); - navigation_controller_->LoadEntry(new TestNavigationEntry( - -1, GURL(WideToUTF8(url)), std::wstring(), frame_string)); + navigation_controller_->LoadEntry(new TestNavigationEntry( + -1, gurl, std::wstring(), frame_string)); } static void WriteTextToFile(const std::wstring& data, |