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

Side by Side Diff: content/shell/renderer/webkit_test_runner.cc

Issue 14985014: Introduce content::PageState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comments to the top of page_state.h Created 7 years, 7 months 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) 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 #include "content/shell/renderer/webkit_test_runner.h" 5 #include "content/shell/renderer/webkit_test_runner.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <clocale> 8 #include <clocale>
9 #include <cmath> 9 #include <cmath>
10 10
11 #include "base/base64.h" 11 #include "base/base64.h"
12 #include "base/debug/debugger.h" 12 #include "base/debug/debugger.h"
13 #include "base/md5.h" 13 #include "base/md5.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/stringprintf.h" 17 #include "base/stringprintf.h"
18 #include "base/strings/sys_string_conversions.h" 18 #include "base/strings/sys_string_conversions.h"
19 #include "base/time.h" 19 #include "base/time.h"
20 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
21 #include "content/public/renderer/history_item_serialization.h"
21 #include "content/public/renderer/render_view.h" 22 #include "content/public/renderer/render_view.h"
22 #include "content/public/renderer/render_view_visitor.h" 23 #include "content/public/renderer/render_view_visitor.h"
23 #include "content/public/test/layouttest_support.h" 24 #include "content/public/test/layouttest_support.h"
24 #include "content/shell/common/shell_messages.h" 25 #include "content/shell/common/shell_messages.h"
25 #include "content/shell/common/webkit_test_helpers.h" 26 #include "content/shell/common/webkit_test_helpers.h"
26 #include "content/shell/renderer/shell_render_process_observer.h" 27 #include "content/shell/renderer/shell_render_process_observer.h"
27 #include "net/base/net_errors.h" 28 #include "net/base/net_errors.h"
28 #include "net/base/net_util.h" 29 #include "net/base/net_util.h"
29 #include "skia/ext/platform_canvas.h" 30 #include "skia/ext/platform_canvas.h"
30 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" 31 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h"
(...skipping 18 matching lines...) Expand all
49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" 50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" 51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h"
51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTestingSupport.h" 52 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTestingSupport.h"
52 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
53 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web Task.h" 54 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web Task.h"
54 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestInterfaces.h" 55 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestInterfaces.h"
55 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestProxy.h" 56 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestProxy.h"
56 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestRunner.h" 57 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestRunner.h"
57 #include "ui/gfx/rect.h" 58 #include "ui/gfx/rect.h"
58 #include "webkit/base/file_path_string_conversions.h" 59 #include "webkit/base/file_path_string_conversions.h"
59 #include "webkit/glue/glue_serialize.h"
60 #include "webkit/glue/webkit_glue.h" 60 #include "webkit/glue/webkit_glue.h"
61 #include "webkit/glue/webpreferences.h" 61 #include "webkit/glue/webpreferences.h"
62 #include "webkit/mocks/test_media_stream_client.h" 62 #include "webkit/mocks/test_media_stream_client.h"
63 63
64 using WebKit::Platform; 64 using WebKit::Platform;
65 using WebKit::WebArrayBufferView; 65 using WebKit::WebArrayBufferView;
66 using WebKit::WebContextMenuData; 66 using WebKit::WebContextMenuData;
67 using WebKit::WebDevToolsAgent; 67 using WebKit::WebDevToolsAgent;
68 using WebKit::WebDeviceOrientation; 68 using WebKit::WebDeviceOrientation;
69 using WebKit::WebElement; 69 using WebKit::WebElement;
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 516
517 if (id == routing_ids_.end()) { 517 if (id == routing_ids_.end()) {
518 NOTREACHED(); 518 NOTREACHED();
519 return; 519 return;
520 } 520 }
521 size_t num_entries = session_histories_[pos].size(); 521 size_t num_entries = session_histories_[pos].size();
522 *currentEntryIndex = current_entry_indexes_[pos]; 522 *currentEntryIndex = current_entry_indexes_[pos];
523 WebVector<WebHistoryItem> result(num_entries); 523 WebVector<WebHistoryItem> result(num_entries);
524 for (size_t entry = 0; entry < num_entries; ++entry) { 524 for (size_t entry = 0; entry < num_entries; ++entry) {
525 result[entry] = 525 result[entry] =
526 webkit_glue::HistoryItemFromString(session_histories_[pos][entry]); 526 PageStateToHistoryItem(session_histories_[pos][entry]);
527 } 527 }
528 history->swap(result); 528 history->swap(result);
529 } 529 }
530 530
531 WebMediaPlayer* WebKitTestRunner::createWebMediaPlayer( 531 WebMediaPlayer* WebKitTestRunner::createWebMediaPlayer(
532 WebFrame* frame, const WebURL& url, WebMediaPlayerClient* client) 532 WebFrame* frame, const WebURL& url, WebMediaPlayerClient* client)
533 { 533 {
534 if (!test_media_stream_client_) { 534 if (!test_media_stream_client_) {
535 test_media_stream_client_.reset( 535 test_media_stream_client_.reset(
536 new webkit_glue::TestMediaStreamClient()); 536 new webkit_glue::TestMediaStreamClient());
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 685
686 WebTestInterfaces* interfaces = 686 WebTestInterfaces* interfaces =
687 ShellRenderProcessObserver::GetInstance()->test_interfaces(); 687 ShellRenderProcessObserver::GetInstance()->test_interfaces();
688 interfaces->setTestIsRunning(true); 688 interfaces->setTestIsRunning(true);
689 interfaces->configureForTestWithURL(params.test_url, 689 interfaces->configureForTestWithURL(params.test_url,
690 params.enable_pixel_dumping); 690 params.enable_pixel_dumping);
691 } 691 }
692 692
693 void WebKitTestRunner::OnSessionHistory( 693 void WebKitTestRunner::OnSessionHistory(
694 const std::vector<int>& routing_ids, 694 const std::vector<int>& routing_ids,
695 const std::vector<std::vector<std::string> >& session_histories, 695 const std::vector<std::vector<PageState> >& session_histories,
696 const std::vector<unsigned>& current_entry_indexes) { 696 const std::vector<unsigned>& current_entry_indexes) {
697 routing_ids_ = routing_ids; 697 routing_ids_ = routing_ids;
698 session_histories_ = session_histories; 698 session_histories_ = session_histories;
699 current_entry_indexes_ = current_entry_indexes; 699 current_entry_indexes_ = current_entry_indexes;
700 CaptureDump(); 700 CaptureDump();
701 } 701 }
702 702
703 void WebKitTestRunner::OnReset() { 703 void WebKitTestRunner::OnReset() {
704 ShellRenderProcessObserver::GetInstance()->test_interfaces()->resetAll(); 704 ShellRenderProcessObserver::GetInstance()->test_interfaces()->resetAll();
705 Reset(); 705 Reset();
706 // Navigating to about:blank will make sure that no new loads are initiated 706 // Navigating to about:blank will make sure that no new loads are initiated
707 // by the renderer. 707 // by the renderer.
708 render_view()->GetWebView()->mainFrame() 708 render_view()->GetWebView()->mainFrame()
709 ->loadRequest(WebURLRequest(GURL("about:blank"))); 709 ->loadRequest(WebURLRequest(GURL("about:blank")));
710 Send(new ShellViewHostMsg_ResetDone(routing_id())); 710 Send(new ShellViewHostMsg_ResetDone(routing_id()));
711 } 711 }
712 712
713 void WebKitTestRunner::OnNotifyDone() { 713 void WebKitTestRunner::OnNotifyDone() {
714 render_view()->GetWebView()->mainFrame()->executeScript( 714 render_view()->GetWebView()->mainFrame()->executeScript(
715 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); 715 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();")));
716 } 716 }
717 717
718 } // namespace content 718 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698