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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug_on_start.h" | 8 #include "base/debug_on_start.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 // URLRequestTestShellFileJob is used to serve the inspector | 88 // URLRequestTestShellFileJob is used to serve the inspector |
89 class URLRequestTestShellFileJob : public URLRequestFileJob { | 89 class URLRequestTestShellFileJob : public URLRequestFileJob { |
90 public: | 90 public: |
91 virtual ~URLRequestTestShellFileJob() { } | 91 virtual ~URLRequestTestShellFileJob() { } |
92 | 92 |
93 static URLRequestJob* InspectorFactory(URLRequest* request, | 93 static URLRequestJob* InspectorFactory(URLRequest* request, |
94 const std::string& scheme) { | 94 const std::string& scheme) { |
95 std::wstring path; | 95 std::wstring path; |
96 PathService::Get(base::DIR_EXE, &path); | 96 PathService::Get(base::DIR_EXE, &path); |
97 file_util::AppendToPath(&path, L"Resources"); | 97 file_util::AppendToPath(&path, L"resources"); |
98 file_util::AppendToPath(&path, L"Inspector"); | 98 file_util::AppendToPath(&path, L"inspector"); |
99 file_util::AppendToPath(&path, UTF8ToWide(request->url().path())); | 99 file_util::AppendToPath(&path, UTF8ToWide(request->url().path())); |
100 return new URLRequestTestShellFileJob(request, | 100 return new URLRequestTestShellFileJob(request, |
101 FilePath::FromWStringHack(path)); | 101 FilePath::FromWStringHack(path)); |
102 } | 102 } |
103 | 103 |
104 private: | 104 private: |
105 URLRequestTestShellFileJob(URLRequest* request, const FilePath& path) | 105 URLRequestTestShellFileJob(URLRequest* request, const FilePath& path) |
106 : URLRequestFileJob(request, path) { | 106 : URLRequestFileJob(request, path) { |
107 } | 107 } |
108 | 108 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 webView()->SetFocusedFrame(frame); | 425 webView()->SetFocusedFrame(frame); |
426 SetFocus(webViewHost(), true); | 426 SetFocus(webViewHost(), true); |
427 | 427 |
428 return true; | 428 return true; |
429 } | 429 } |
430 | 430 |
431 void TestShell::GoBackOrForward(int offset) { | 431 void TestShell::GoBackOrForward(int offset) { |
432 navigation_controller_->GoToOffset(offset); | 432 navigation_controller_->GoToOffset(offset); |
433 } | 433 } |
434 | 434 |
| 435 void TestShell::DumpDocumentText() { |
| 436 std::wstring file_path; |
| 437 if (!PromptForSaveFile(L"Dump document text", &file_path)) |
| 438 return; |
| 439 |
| 440 const std::string data = |
| 441 WideToUTF8(webkit_glue::DumpDocumentText(webView()->GetMainFrame())); |
| 442 file_util::WriteFile(file_path, data.c_str(), data.length()); |
| 443 } |
| 444 |
| 445 void TestShell::DumpRenderTree() { |
| 446 std::wstring file_path; |
| 447 if (!PromptForSaveFile(L"Dump render tree", &file_path)) |
| 448 return; |
| 449 |
| 450 const std::string data = |
| 451 WideToUTF8(webkit_glue::DumpRenderer(webView()->GetMainFrame())); |
| 452 file_util::WriteFile(file_path, data.c_str(), data.length()); |
| 453 } |
| 454 |
435 std::wstring TestShell::GetDocumentText() { | 455 std::wstring TestShell::GetDocumentText() { |
436 return webkit_glue::DumpDocumentText(webView()->GetMainFrame()); | 456 return webkit_glue::DumpDocumentText(webView()->GetMainFrame()); |
437 } | 457 } |
438 | 458 |
439 void TestShell::Reload() { | 459 void TestShell::Reload() { |
440 navigation_controller_->Reload(); | 460 navigation_controller_->Reload(); |
441 } | 461 } |
442 | 462 |
443 void TestShell::SetFocus(WebWidgetHost* host, bool enable) { | 463 void TestShell::SetFocus(WebWidgetHost* host, bool enable) { |
444 if (!layout_test_mode_) { | 464 if (!layout_test_mode_) { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 | 625 |
606 uint64 VisitedLinkHash(const char* canonical_url, size_t length) { | 626 uint64 VisitedLinkHash(const char* canonical_url, size_t length) { |
607 return 0; | 627 return 0; |
608 } | 628 } |
609 | 629 |
610 bool IsLinkVisited(uint64 link_hash) { | 630 bool IsLinkVisited(uint64 link_hash) { |
611 return false; | 631 return false; |
612 } | 632 } |
613 | 633 |
614 } // namespace webkit_glue | 634 } // namespace webkit_glue |
OLD | NEW |