diff options
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/dom_serializer_unittest.cc | 16 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_gtk.cc | 19 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_mac.mm | 29 |
3 files changed, 30 insertions, 34 deletions
diff --git a/webkit/glue/dom_serializer_unittest.cc b/webkit/glue/dom_serializer_unittest.cc index b5df8e2..d4f73bc 100644 --- a/webkit/glue/dom_serializer_unittest.cc +++ b/webkit/glue/dom_serializer_unittest.cc @@ -22,6 +22,7 @@ MSVC_PUSH_WARNING_LEVEL(0); MSVC_POP_WARNING(); #undef LOG +#include "base/file_path.h" #include "base/file_util.h" #include "base/hash_tables.h" #include "base/string_util.h" @@ -572,15 +573,18 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithEntitiesInAttributeValue) { TEST_F(DomSerializerTests, SerialzeHTMLDOMWithBaseTag) { // There are total 2 available base tags in this test file. const int kTotalBaseTagCountInTestFile = 2; - std::wstring page_file_path = data_dir_; - file_util::AppendToPath(&page_file_path, L"dom_serializer"); - page_file_path.append(1, file_util::kPathSeparator); + + FilePath page_file_path = FilePath::FromWStringHack(data_dir_).Append( + FILE_PATH_LITERAL("dom_serializer")); + file_util::EnsureEndsWithSeparator(&page_file_path); + // Get page dir URL which is base URL of this file. - GURL path_dir_url = net::FilePathToFileURL(page_file_path); + GURL path_dir_url = net::FilePathToFileURL(page_file_path.ToWStringHack()); // Get file path. - file_util::AppendToPath(&page_file_path, L"html_doc_has_base_tag.htm"); + page_file_path = + page_file_path.Append(FILE_PATH_LITERAL("html_doc_has_base_tag.htm")); // Get file URL. - GURL file_url = net::FilePathToFileURL(page_file_path); + GURL file_url = net::FilePathToFileURL(page_file_path.ToWStringHack()); ASSERT_TRUE(file_url.SchemeIsFile()); std::wstring page_url = ASCIIToWide(file_url.spec()); // Load the test file. diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc index 52cf2a0..0dabe3e 100644 --- a/webkit/tools/test_shell/test_shell_gtk.cc +++ b/webkit/tools/test_shell/test_shell_gtk.cc @@ -532,6 +532,7 @@ void TestShell::DumpRenderTree() file_path); } +// static std::string TestShell::RewriteLocalUrl(const std::string& url) { // Convert file:///tmp/LayoutTests urls to the actual location on disk. const char kPrefix[] = "file:///tmp/LayoutTests/"; @@ -539,18 +540,14 @@ std::string TestShell::RewriteLocalUrl(const std::string& url) { std::string new_url(url); if (url.compare(0, kPrefixLen, kPrefix, kPrefixLen) == 0) { - std::wstring replace_url; - PathService::Get(base::DIR_EXE, &replace_url); - file_util::UpOneDirectory(&replace_url); - file_util::UpOneDirectory(&replace_url); - file_util::AppendToPath(&replace_url, L"webkit"); - file_util::AppendToPath(&replace_url, L"data"); - file_util::AppendToPath(&replace_url, L"layout_tests"); - file_util::AppendToPath(&replace_url, L"LayoutTests"); - replace_url.push_back(file_util::kPathSeparator); - new_url = std::string("file:///") + - WideToUTF8(replace_url).append(url.substr(kPrefixLen)); + FilePath replace_path; + PathService::Get(base::DIR_EXE, &replace_path); + replace_path = replace_path.DirName().DirName().Append( + "webkit/data/layout_tests/LayoutTests/"); + new_url = std::string("file://") + replace_path.value() + + url.substr(kPrefixLen); } + return new_url; } diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm index 6b9c211..d4603ea 100644 --- a/webkit/tools/test_shell/test_shell_mac.mm +++ b/webkit/tools/test_shell/test_shell_mac.mm @@ -576,7 +576,7 @@ void TestShell::DumpDocumentText() std::wstring file_path; if (!PromptForSaveFile(L"Dump document text", &file_path)) return; - + WriteTextToFile( WideToUTF8(webkit_glue::DumpDocumentText(webView()->GetMainFrame())), WideToUTF8(file_path)); @@ -587,33 +587,28 @@ void TestShell::DumpRenderTree() std::wstring file_path; if (!PromptForSaveFile(L"Dump render tree", &file_path)) return; - + WriteTextToFile( WideToUTF8(webkit_glue::DumpRenderer(webView()->GetMainFrame())), WideToUTF8(file_path)); } -/* static */ +// static std::string TestShell::RewriteLocalUrl(const std::string& url) { // Convert file:///tmp/LayoutTests urls to the actual location on disk. const char kPrefix[] = "file:///tmp/LayoutTests/"; const int kPrefixLen = arraysize(kPrefix) - 1; - + std::string new_url(url); if (url.compare(0, kPrefixLen, kPrefix, kPrefixLen) == 0) { - std::wstring replace_url; - PathService::Get(base::DIR_EXE, &replace_url); - file_util::UpOneDirectory(&replace_url); - file_util::UpOneDirectory(&replace_url); - file_util::AppendToPath(&replace_url, L"webkit"); - file_util::AppendToPath(&replace_url, L"data"); - file_util::AppendToPath(&replace_url, L"layout_tests"); - file_util::AppendToPath(&replace_url, L"LayoutTests"); - replace_url.push_back(file_util::kPathSeparator); - std::string replace_url8 = WideToUTF8(replace_url); - new_url = std::string("file:///") + - replace_url8.append(url.substr(kPrefixLen)); + FilePath replace_path; + PathService::Get(base::DIR_EXE, &replace_path); + replace_path = replace_path.DirName().DirName().Append( + "webkit/data/layout_tests/LayoutTests/"); + new_url = std::string("file://") + replace_path.value() + + url.substr(kPrefixLen); } + return new_url; } @@ -629,7 +624,7 @@ namespace webkit_glue { std::wstring GetLocalizedString(int message_id) { NSString* idString = [NSString stringWithFormat:@"%d", message_id]; NSString* localString = NSLocalizedString(idString, @""); - + return UTF8ToWide([localString UTF8String]); } |