Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1064)

Side by Side Diff: webkit/tools/test_shell/test_shell.cc

Issue 5591004: glue: use string16 in place of wstring for Unicode text (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/tools/test_shell/test_shell.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #undef LOG 5 #undef LOG
6 6
7 #include "webkit/tools/test_shell/test_shell.h" 7 #include "webkit/tools/test_shell/test_shell.h"
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 const string16& mime_type = 253 const string16& mime_type =
254 frame->dataSource()->response().mimeType(); 254 frame->dataSource()->response().mimeType();
255 if (EqualsASCII(mime_type, "text/plain")) { 255 if (EqualsASCII(mime_type, "text/plain")) {
256 should_dump_as_text = true; 256 should_dump_as_text = true;
257 should_generate_pixel_results = false; 257 should_generate_pixel_results = false;
258 } 258 }
259 } 259 }
260 if (should_dump_as_text) { 260 if (should_dump_as_text) {
261 bool recursive = shell->layout_test_controller_-> 261 bool recursive = shell->layout_test_controller_->
262 ShouldDumpChildFramesAsText(); 262 ShouldDumpChildFramesAsText();
263 std::string data_utf8 = WideToUTF8( 263 std::string data_utf8 = UTF16ToUTF8(
264 webkit_glue::DumpFramesAsText(frame, recursive)); 264 webkit_glue::DumpFramesAsText(frame, recursive));
265 if (fwrite(data_utf8.c_str(), 1, data_utf8.size(), stdout) != 265 if (fwrite(data_utf8.c_str(), 1, data_utf8.size(), stdout) !=
266 data_utf8.size()) { 266 data_utf8.size()) {
267 LOG(FATAL) << "Short write to stdout, disk full?"; 267 LOG(FATAL) << "Short write to stdout, disk full?";
268 } 268 }
269 } else { 269 } else {
270 printf("%s", WideToUTF8( 270 printf("%s", UTF16ToUTF8(
271 webkit_glue::DumpRenderer(frame)).c_str()); 271 webkit_glue::DumpRenderer(frame)).c_str());
272 272
273 bool recursive = shell->layout_test_controller_-> 273 bool recursive = shell->layout_test_controller_->
274 ShouldDumpChildFrameScrollPositions(); 274 ShouldDumpChildFrameScrollPositions();
275 printf("%s", WideToUTF8( 275 printf("%s", WideToUTF8(
276 webkit_glue::DumpFrameScrollPosition(frame, recursive)).c_str()); 276 webkit_glue::DumpFrameScrollPosition(frame, recursive)).c_str());
277 } 277 }
278 278
279 if (shell->layout_test_controller_->ShouldDumpBackForwardList()) { 279 if (shell->layout_test_controller_->ShouldDumpBackForwardList()) {
280 std::wstring bfDump; 280 std::wstring bfDump;
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 void TestShell::GoBackOrForward(int offset) { 710 void TestShell::GoBackOrForward(int offset) {
711 navigation_controller_->GoToOffset(offset); 711 navigation_controller_->GoToOffset(offset);
712 } 712 }
713 713
714 void TestShell::DumpDocumentText() { 714 void TestShell::DumpDocumentText() {
715 FilePath file_path; 715 FilePath file_path;
716 if (!PromptForSaveFile(L"Dump document text", &file_path)) 716 if (!PromptForSaveFile(L"Dump document text", &file_path))
717 return; 717 return;
718 718
719 const std::string data = 719 const std::string data =
720 WideToUTF8(webkit_glue::DumpDocumentText(webView()->mainFrame())); 720 UTF16ToUTF8(webkit_glue::DumpDocumentText(webView()->mainFrame()));
721 file_util::WriteFile(file_path, data.c_str(), data.length()); 721 file_util::WriteFile(file_path, data.c_str(), data.length());
722 } 722 }
723 723
724 void TestShell::DumpRenderTree() { 724 void TestShell::DumpRenderTree() {
725 FilePath file_path; 725 FilePath file_path;
726 if (!PromptForSaveFile(L"Dump render tree", &file_path)) 726 if (!PromptForSaveFile(L"Dump render tree", &file_path))
727 return; 727 return;
728 728
729 const std::string data = 729 const std::string data =
730 WideToUTF8(webkit_glue::DumpRenderer(webView()->mainFrame())); 730 UTF16ToUTF8(webkit_glue::DumpRenderer(webView()->mainFrame()));
731 file_util::WriteFile(file_path, data.c_str(), data.length()); 731 file_util::WriteFile(file_path, data.c_str(), data.length());
732 } 732 }
733 733
734 std::wstring TestShell::GetDocumentText() { 734 string16 TestShell::GetDocumentText() {
735 return webkit_glue::DumpDocumentText(webView()->mainFrame()); 735 return webkit_glue::DumpDocumentText(webView()->mainFrame());
736 } 736 }
737 737
738 void TestShell::Reload() { 738 void TestShell::Reload() {
739 navigation_controller_->Reload(); 739 navigation_controller_->Reload();
740 } 740 }
741 741
742 void TestShell::SetFocus(WebWidgetHost* host, bool enable) { 742 void TestShell::SetFocus(WebWidgetHost* host, bool enable) {
743 if (!layout_test_mode_) { 743 if (!layout_test_mode_) {
744 InteractiveSetFocus(host, enable); 744 InteractiveSetFocus(host, enable);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) { 889 for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) {
890 if (plugin_info.path.BaseName() == FilePath(kPluginBlackList[j])) { 890 if (plugin_info.path.BaseName() == FilePath(kPluginBlackList[j])) {
891 NPAPI::PluginList::Singleton()->DisablePlugin(plugin_info.path); 891 NPAPI::PluginList::Singleton()->DisablePlugin(plugin_info.path);
892 plugins->erase(plugins->begin() + i); 892 plugins->erase(plugins->begin() + i);
893 } 893 }
894 } 894 }
895 } 895 }
896 } 896 }
897 897
898 } // namespace webkit_glue 898 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/test_shell.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698