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

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

Issue 5729005: webkit: use string16 in webkit_glue.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
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", UTF16ToUTF8( 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", UTF16ToUTF8(
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 string16 bfDump;
281 DumpAllBackForwardLists(&bfDump); 281 DumpAllBackForwardLists(&bfDump);
282 printf("%s", WideToUTF8(bfDump).c_str()); 282 printf("%s", UTF16ToUTF8(bfDump).c_str());
283 } 283 }
284 } 284 }
285 285
286 if (params->dump_pixels && should_generate_pixel_results) { 286 if (params->dump_pixels && should_generate_pixel_results) {
287 // Image output: we write the image data to the file given on the 287 // Image output: we write the image data to the file given on the
288 // command line (for the dump pixels argument), and the MD5 sum to 288 // command line (for the dump pixels argument), and the MD5 sum to
289 // stdout. 289 // stdout.
290 dumped_anything = true; 290 dumped_anything = true;
291 WebViewHost* view_host = shell->webViewHost(); 291 WebViewHost* view_host = shell->webViewHost();
292 view_host->webview()->layout(); 292 view_host->webview()->layout();
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 if (layout_test_mode_) { 556 if (layout_test_mode_) {
557 accessibility_controller_->BindToJavascript( 557 accessibility_controller_->BindToJavascript(
558 frame, "accessibilityController"); 558 frame, "accessibilityController");
559 layout_test_controller_->BindToJavascript(frame, "layoutTestController"); 559 layout_test_controller_->BindToJavascript(frame, "layoutTestController");
560 event_sending_controller_->BindToJavascript(frame, "eventSender"); 560 event_sending_controller_->BindToJavascript(frame, "eventSender");
561 plain_text_controller_->BindToJavascript(frame, "plainText"); 561 plain_text_controller_->BindToJavascript(frame, "plainText");
562 text_input_controller_->BindToJavascript(frame, "textInputController"); 562 text_input_controller_->BindToJavascript(frame, "textInputController");
563 } 563 }
564 } 564 }
565 565
566 void TestShell::DumpBackForwardEntry(int index, std::wstring* result) { 566 void TestShell::DumpBackForwardEntry(int index, string16* result) {
567 int current_index = navigation_controller_->GetLastCommittedEntryIndex(); 567 int current_index = navigation_controller_->GetLastCommittedEntryIndex();
568 568
569 std::string content_state = 569 std::string content_state =
570 navigation_controller_->GetEntryAtIndex(index)->GetContentState(); 570 navigation_controller_->GetEntryAtIndex(index)->GetContentState();
571 if (content_state.empty()) { 571 if (content_state.empty()) {
572 content_state = webkit_glue::CreateHistoryStateForURL( 572 content_state = webkit_glue::CreateHistoryStateForURL(
573 navigation_controller_->GetEntryAtIndex(index)->GetURL()); 573 navigation_controller_->GetEntryAtIndex(index)->GetURL());
574 } 574 }
575 575
576 result->append( 576 result->append(
577 webkit_glue::DumpHistoryState(content_state, 8, index == current_index)); 577 webkit_glue::DumpHistoryState(content_state, 8, index == current_index));
578 } 578 }
579 579
580 void TestShell::DumpBackForwardList(std::wstring* result) { 580 void TestShell::DumpBackForwardList(string16* result) {
581 result->append(L"\n============== Back Forward List ==============\n"); 581 result->append(ASCIIToUTF16(
582 "\n============== Back Forward List ==============\n"));
582 583
583 for (int i = 0; i < navigation_controller_->GetEntryCount(); ++i) 584 for (int i = 0; i < navigation_controller_->GetEntryCount(); ++i)
584 DumpBackForwardEntry(i, result); 585 DumpBackForwardEntry(i, result);
585 586
586 result->append(L"===============================================\n"); 587 result->append(ASCIIToUTF16(
588 "===============================================\n"));
587 } 589 }
588 590
589 void TestShell::CallJSGC() { 591 void TestShell::CallJSGC() {
590 webView()->mainFrame()->collectGarbage(); 592 webView()->mainFrame()->collectGarbage();
591 } 593 }
592 594
593 WebView* TestShell::CreateWebView() { 595 WebView* TestShell::CreateWebView() {
594 // If we're running layout tests, only open a new window if the test has 596 // If we're running layout tests, only open a new window if the test has
595 // called layoutTestController.setCanOpenWindows() 597 // called layoutTestController.setCanOpenWindows()
596 if (layout_test_mode_ && !layout_test_controller_->CanOpenWindows()) 598 if (layout_test_mode_ && !layout_test_controller_->CanOpenWindows())
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) { 891 for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) {
890 if (plugin_info.path.BaseName() == FilePath(kPluginBlackList[j])) { 892 if (plugin_info.path.BaseName() == FilePath(kPluginBlackList[j])) {
891 NPAPI::PluginList::Singleton()->DisablePlugin(plugin_info.path); 893 NPAPI::PluginList::Singleton()->DisablePlugin(plugin_info.path);
892 plugins->erase(plugins->begin() + i); 894 plugins->erase(plugins->begin() + i);
893 } 895 }
894 } 896 }
895 } 897 }
896 } 898 }
897 899
898 } // namespace webkit_glue 900 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698