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 // This file contains the definition for LayoutTestController. | 5 // This file contains the definition for LayoutTestController. |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "webkit/tools/test_shell/layout_test_controller.h" | 9 #include "webkit/tools/test_shell/layout_test_controller.h" |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/file_util.h" | 12 #include "base/file_path.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" | 17 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" |
18 #include "webkit/glue/dom_operations.h" | 18 #include "webkit/glue/dom_operations.h" |
19 #include "webkit/glue/webframe.h" | 19 #include "webkit/glue/webframe.h" |
20 #include "webkit/glue/webpreferences.h" | 20 #include "webkit/glue/webpreferences.h" |
21 #include "webkit/glue/webview.h" | 21 #include "webkit/glue/webview.h" |
22 #include "webkit/tools/test_shell/test_navigation_controller.h" | 22 #include "webkit/tools/test_shell/test_navigation_controller.h" |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 | 589 |
590 void LayoutTestController::pathToLocalResource( | 590 void LayoutTestController::pathToLocalResource( |
591 const CppArgumentList& args, CppVariant* result) { | 591 const CppArgumentList& args, CppVariant* result) { |
592 result->SetNull(); | 592 result->SetNull(); |
593 if (args.size() <= 0 || !args[0].isString()) | 593 if (args.size() <= 0 || !args[0].isString()) |
594 return; | 594 return; |
595 | 595 |
596 std::string url = args[0].ToString(); | 596 std::string url = args[0].ToString(); |
597 if (StartsWithASCII(url, "/tmp/", true)) { | 597 if (StartsWithASCII(url, "/tmp/", true)) { |
598 // We want a temp file. | 598 // We want a temp file. |
599 std::wstring path; | 599 FilePath path; |
600 PathService::Get(base::DIR_TEMP, &path); | 600 PathService::Get(base::DIR_TEMP, &path); |
601 file_util::AppendToPath(&path, UTF8ToWide(url.substr(5))); | 601 path = path.AppendASCII(url.substr(5)); |
602 result->Set(WideToUTF8(path)); | 602 result->Set(WideToUTF8(path.ToWStringHack())); |
603 return; | 603 return; |
604 } | 604 } |
605 | 605 |
606 // Some layout tests use file://// which we resolve as a UNC path. Normalize | 606 // Some layout tests use file://// which we resolve as a UNC path. Normalize |
607 // them to just file:///. | 607 // them to just file:///. |
608 while (StartsWithASCII(url, "file:////", false)) { | 608 while (StartsWithASCII(url, "file:////", false)) { |
609 url = url.substr(0, 8) + url.substr(9); | 609 url = url.substr(0, 8) + url.substr(9); |
610 } | 610 } |
611 GURL location(TestShell::RewriteLocalUrl(url)); | 611 GURL location(TestShell::RewriteLocalUrl(url)); |
612 result->Set(location.spec()); | 612 result->Set(location.spec()); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 void LayoutTestController::fallbackMethod( | 767 void LayoutTestController::fallbackMethod( |
768 const CppArgumentList& args, CppVariant* result) { | 768 const CppArgumentList& args, CppVariant* result) { |
769 std::wstring message(L"JavaScript ERROR: unknown method called on LayoutTestCo
ntroller"); | 769 std::wstring message(L"JavaScript ERROR: unknown method called on LayoutTestCo
ntroller"); |
770 if (!shell_->layout_test_mode()) { | 770 if (!shell_->layout_test_mode()) { |
771 logging::LogMessage("CONSOLE:", 0).stream() << message; | 771 logging::LogMessage("CONSOLE:", 0).stream() << message; |
772 } else { | 772 } else { |
773 printf("CONSOLE MESSAGE: %S\n", message.c_str()); | 773 printf("CONSOLE MESSAGE: %S\n", message.c_str()); |
774 } | 774 } |
775 result->SetNull(); | 775 result->SetNull(); |
776 } | 776 } |
OLD | NEW |