OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "webkit/tools/test_shell/test_shell.h" | 5 #include "webkit/tools/test_shell/test_shell.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <fontconfig/fontconfig.h> | 9 #include <fontconfig/fontconfig.h> |
10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 void TestShell::DumpRenderTree() | 525 void TestShell::DumpRenderTree() |
526 { | 526 { |
527 FilePath file_path; | 527 FilePath file_path; |
528 if (!::PromptForSaveFile("Dump render tree", &file_path)) | 528 if (!::PromptForSaveFile("Dump render tree", &file_path)) |
529 return; | 529 return; |
530 | 530 |
531 WriteTextToFile(webkit_glue::DumpRenderer(webView()->GetMainFrame()), | 531 WriteTextToFile(webkit_glue::DumpRenderer(webView()->GetMainFrame()), |
532 file_path); | 532 file_path); |
533 } | 533 } |
534 | 534 |
| 535 // static |
535 std::string TestShell::RewriteLocalUrl(const std::string& url) { | 536 std::string TestShell::RewriteLocalUrl(const std::string& url) { |
536 // Convert file:///tmp/LayoutTests urls to the actual location on disk. | 537 // Convert file:///tmp/LayoutTests urls to the actual location on disk. |
537 const char kPrefix[] = "file:///tmp/LayoutTests/"; | 538 const char kPrefix[] = "file:///tmp/LayoutTests/"; |
538 const int kPrefixLen = arraysize(kPrefix) - 1; | 539 const int kPrefixLen = arraysize(kPrefix) - 1; |
539 | 540 |
540 std::string new_url(url); | 541 std::string new_url(url); |
541 if (url.compare(0, kPrefixLen, kPrefix, kPrefixLen) == 0) { | 542 if (url.compare(0, kPrefixLen, kPrefix, kPrefixLen) == 0) { |
542 std::wstring replace_url; | 543 FilePath replace_path; |
543 PathService::Get(base::DIR_EXE, &replace_url); | 544 PathService::Get(base::DIR_EXE, &replace_path); |
544 file_util::UpOneDirectory(&replace_url); | 545 replace_path = replace_path.DirName().DirName().Append( |
545 file_util::UpOneDirectory(&replace_url); | 546 "webkit/data/layout_tests/LayoutTests/"); |
546 file_util::AppendToPath(&replace_url, L"webkit"); | 547 new_url = std::string("file://") + replace_path.value() + |
547 file_util::AppendToPath(&replace_url, L"data"); | 548 url.substr(kPrefixLen); |
548 file_util::AppendToPath(&replace_url, L"layout_tests"); | |
549 file_util::AppendToPath(&replace_url, L"LayoutTests"); | |
550 replace_url.push_back(file_util::kPathSeparator); | |
551 new_url = std::string("file:///") + | |
552 WideToUTF8(replace_url).append(url.substr(kPrefixLen)); | |
553 } | 549 } |
| 550 |
554 return new_url; | 551 return new_url; |
555 } | 552 } |
556 | 553 |
557 // static | 554 // static |
558 void TestShell::ShowStartupDebuggingDialog() { | 555 void TestShell::ShowStartupDebuggingDialog() { |
559 GtkWidget* dialog = gtk_message_dialog_new( | 556 GtkWidget* dialog = gtk_message_dialog_new( |
560 NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "attach to me?"); | 557 NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "attach to me?"); |
561 gtk_window_set_title(GTK_WINDOW(dialog), "test_shell"); | 558 gtk_window_set_title(GTK_WINDOW(dialog), "test_shell"); |
562 gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop. | 559 gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop. |
563 gtk_widget_destroy(dialog); | 560 gtk_widget_destroy(dialog); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 // of NOTIMPLEMENTED into our layout test diffs. | 704 // of NOTIMPLEMENTED into our layout test diffs. |
708 // NOTIMPLEMENTED(); | 705 // NOTIMPLEMENTED(); |
709 return false; | 706 return false; |
710 } | 707 } |
711 | 708 |
712 ScreenInfo GetScreenInfo(gfx::ViewHandle window) { | 709 ScreenInfo GetScreenInfo(gfx::ViewHandle window) { |
713 return GetScreenInfoHelper(window); | 710 return GetScreenInfoHelper(window); |
714 } | 711 } |
715 | 712 |
716 } // namespace webkit_glue | 713 } // namespace webkit_glue |
OLD | NEW |