OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 408 |
409 void TestShell::TestTimedOut() { | 409 void TestShell::TestTimedOut() { |
410 puts("#TEST_TIMED_OUT\n"); | 410 puts("#TEST_TIMED_OUT\n"); |
411 TestFinished(); | 411 TestFinished(); |
412 } | 412 } |
413 | 413 |
414 void TestShell::Show(WebNavigationPolicy policy) { | 414 void TestShell::Show(WebNavigationPolicy policy) { |
415 delegate_->show(policy); | 415 delegate_->show(policy); |
416 } | 416 } |
417 | 417 |
418 void TestShell::DumpBackForwardEntry(int index, string16* result) { | 418 void TestShell::DumpBackForwardEntry(int index, base::string16* result) { |
419 int current_index = navigation_controller_->GetLastCommittedEntryIndex(); | 419 int current_index = navigation_controller_->GetLastCommittedEntryIndex(); |
420 | 420 |
421 std::string content_state = | 421 std::string content_state = |
422 navigation_controller_->GetEntryAtIndex(index)->GetContentState(); | 422 navigation_controller_->GetEntryAtIndex(index)->GetContentState(); |
423 if (content_state.empty()) { | 423 if (content_state.empty()) { |
424 content_state = webkit_glue::CreateHistoryStateForURL( | 424 content_state = webkit_glue::CreateHistoryStateForURL( |
425 navigation_controller_->GetEntryAtIndex(index)->GetURL()); | 425 navigation_controller_->GetEntryAtIndex(index)->GetURL()); |
426 } | 426 } |
427 | 427 |
428 result->append( | 428 result->append( |
429 webkit_glue::DumpHistoryState(content_state, 8, index == current_index)); | 429 webkit_glue::DumpHistoryState(content_state, 8, index == current_index)); |
430 } | 430 } |
431 | 431 |
432 void TestShell::DumpBackForwardList(string16* result) { | 432 void TestShell::DumpBackForwardList(base::string16* result) { |
433 result->append(ASCIIToUTF16( | 433 result->append(ASCIIToUTF16( |
434 "\n============== Back Forward List ==============\n")); | 434 "\n============== Back Forward List ==============\n")); |
435 | 435 |
436 for (int i = 0; i < navigation_controller_->GetEntryCount(); ++i) | 436 for (int i = 0; i < navigation_controller_->GetEntryCount(); ++i) |
437 DumpBackForwardEntry(i, result); | 437 DumpBackForwardEntry(i, result); |
438 | 438 |
439 result->append(ASCIIToUTF16( | 439 result->append(ASCIIToUTF16( |
440 "===============================================\n")); | 440 "===============================================\n")); |
441 } | 441 } |
442 | 442 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 } | 496 } |
497 | 497 |
498 void TestShell::ResetTestController() { | 498 void TestShell::ResetTestController() { |
499 notification_presenter_->Reset(); | 499 notification_presenter_->Reset(); |
500 delegate_->Reset(); | 500 delegate_->Reset(); |
501 if (geolocation_client_mock_.get()) | 501 if (geolocation_client_mock_.get()) |
502 geolocation_client_mock_->resetMock(); | 502 geolocation_client_mock_->resetMock(); |
503 } | 503 } |
504 | 504 |
505 void TestShell::LoadFile(const base::FilePath& file) { | 505 void TestShell::LoadFile(const base::FilePath& file) { |
506 LoadURLForFrame(net::FilePathToFileURL(file), string16()); | 506 LoadURLForFrame(net::FilePathToFileURL(file), base::string16()); |
507 } | 507 } |
508 | 508 |
509 void TestShell::LoadURL(const GURL& url) { | 509 void TestShell::LoadURL(const GURL& url) { |
510 LoadURLForFrame(url, string16()); | 510 LoadURLForFrame(url, base::string16()); |
511 } | 511 } |
512 | 512 |
513 bool TestShell::Navigate(const TestNavigationEntry& entry, bool reload) { | 513 bool TestShell::Navigate(const TestNavigationEntry& entry, bool reload) { |
514 // Get the right target frame for the entry. | 514 // Get the right target frame for the entry. |
515 WebFrame* frame = webView()->mainFrame(); | 515 WebFrame* frame = webView()->mainFrame(); |
516 if (!entry.GetTargetFrame().empty()) | 516 if (!entry.GetTargetFrame().empty()) |
517 frame = webView()->findFrameByName(entry.GetTargetFrame()); | 517 frame = webView()->findFrameByName(entry.GetTargetFrame()); |
518 | 518 |
519 // TODO(mpcomplete): should we clear the target frame, or should | 519 // TODO(mpcomplete): should we clear the target frame, or should |
520 // back/forward navigations maintain the target frame? | 520 // back/forward navigations maintain the target frame? |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 void TestShell::DumpRenderTree() { | 571 void TestShell::DumpRenderTree() { |
572 base::FilePath file_path; | 572 base::FilePath file_path; |
573 if (!PromptForSaveFile(L"Dump render tree", &file_path)) | 573 if (!PromptForSaveFile(L"Dump render tree", &file_path)) |
574 return; | 574 return; |
575 | 575 |
576 const std::string data = | 576 const std::string data = |
577 UTF16ToUTF8(webkit_glue::DumpRenderer(webView()->mainFrame())); | 577 UTF16ToUTF8(webkit_glue::DumpRenderer(webView()->mainFrame())); |
578 file_util::WriteFile(file_path, data.c_str(), data.length()); | 578 file_util::WriteFile(file_path, data.c_str(), data.length()); |
579 } | 579 } |
580 | 580 |
581 string16 TestShell::GetDocumentText() { | 581 base::string16 TestShell::GetDocumentText() { |
582 return webkit_glue::DumpDocumentText(webView()->mainFrame()); | 582 return webkit_glue::DumpDocumentText(webView()->mainFrame()); |
583 } | 583 } |
584 | 584 |
585 void TestShell::Reload() { | 585 void TestShell::Reload() { |
586 navigation_controller_->Reload(); | 586 navigation_controller_->Reload(); |
587 } | 587 } |
588 | 588 |
589 void TestShell::SetFocus(WebWidgetHost* host, bool enable) { | 589 void TestShell::SetFocus(WebWidgetHost* host, bool enable) { |
590 if (!layout_test_mode_) { | 590 if (!layout_test_mode_) { |
591 InteractiveSetFocus(host, enable); | 591 InteractiveSetFocus(host, enable); |
(...skipping 27 matching lines...) Expand all Loading... |
619 return device_orientation_client_mock_.get(); | 619 return device_orientation_client_mock_.get(); |
620 } | 620 } |
621 | 621 |
622 WebKit::WebGeolocationClientMock* TestShell::geolocation_client_mock() { | 622 WebKit::WebGeolocationClientMock* TestShell::geolocation_client_mock() { |
623 if (!geolocation_client_mock_.get()) { | 623 if (!geolocation_client_mock_.get()) { |
624 geolocation_client_mock_.reset( | 624 geolocation_client_mock_.reset( |
625 WebKit::WebGeolocationClientMock::create()); | 625 WebKit::WebGeolocationClientMock::create()); |
626 } | 626 } |
627 return geolocation_client_mock_.get(); | 627 return geolocation_client_mock_.get(); |
628 } | 628 } |
OLD | NEW |