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

Side by Side Diff: content/shell/renderer/layout_test/blink_test_runner.cc

Issue 1685003002: Plumb the correct owner document through DocumentInit::m_owner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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
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/layout_test/blink_test_runner.h" 5 #include "content/shell/renderer/layout_test/blink_test_runner.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <clocale> 9 #include <clocale>
10 #include <cmath> 10 #include <cmath>
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 render_view()->GetWebView()->setFocusedFrame(frame); 835 render_view()->GetWebView()->setFocusedFrame(frame);
836 } 836 }
837 837
838 void BlinkTestRunner::DidFailProvisionalLoad(WebLocalFrame* frame, 838 void BlinkTestRunner::DidFailProvisionalLoad(WebLocalFrame* frame,
839 const WebURLError& error) { 839 const WebURLError& error) {
840 focus_on_next_commit_ = false; 840 focus_on_next_commit_ = false;
841 } 841 }
842 842
843 // Public methods - ----------------------------------------------------------- 843 // Public methods - -----------------------------------------------------------
844 844
845 void BlinkTestRunner::Reset() { 845 void BlinkTestRunner::Reset(bool for_new_test) {
846 // The proxy_ is always non-NULL, it is set right after construction. 846 // The proxy_ is always non-NULL, it is set right after construction.
847 proxy_->set_widget(render_view()->GetWebView()); 847 proxy_->set_widget(render_view()->GetWebView());
848 proxy_->Reset(); 848 proxy_->Reset();
849 prefs_.Reset(); 849 prefs_.Reset();
850 routing_ids_.clear(); 850 routing_ids_.clear();
851 session_histories_.clear(); 851 session_histories_.clear();
852 current_entry_indexes_.clear(); 852 current_entry_indexes_.clear();
853 853
854 render_view()->ClearEditCommands(); 854 render_view()->ClearEditCommands();
855 if (render_view()->GetWebView()->mainFrame()->isWebLocalFrame()) 855 if (for_new_test) {
856 render_view()->GetWebView()->mainFrame()->setName(WebString()); 856 if (render_view()->GetWebView()->mainFrame()->isWebLocalFrame())
857 render_view()->GetWebView()->mainFrame()->clearOpener(); 857 render_view()->GetWebView()->mainFrame()->setName(WebString());
858 render_view()->GetWebView()->mainFrame()->clearOpener();
859 }
858 860
859 // Resetting the internals object also overrides the WebPreferences, so we 861 // Resetting the internals object also overrides the WebPreferences, so we
860 // have to sync them to WebKit again. 862 // have to sync them to WebKit again.
861 if (render_view()->GetWebView()->mainFrame()->isWebLocalFrame()) { 863 if (render_view()->GetWebView()->mainFrame()->isWebLocalFrame()) {
862 WebTestingSupport::resetInternalsObject( 864 WebTestingSupport::resetInternalsObject(
863 render_view()->GetWebView()->mainFrame()->toWebLocalFrame()); 865 render_view()->GetWebView()->mainFrame()->toWebLocalFrame());
864 render_view()->SetWebkitPreferences(render_view()->GetWebkitPreferences()); 866 render_view()->SetWebkitPreferences(render_view()->GetWebkitPreferences());
865 } 867 }
866 } 868 }
867 869
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 const std::vector<std::vector<PageState>>& session_histories, 997 const std::vector<std::vector<PageState>>& session_histories,
996 const std::vector<unsigned>& current_entry_indexes) { 998 const std::vector<unsigned>& current_entry_indexes) {
997 routing_ids_ = routing_ids; 999 routing_ids_ = routing_ids;
998 session_histories_ = session_histories; 1000 session_histories_ = session_histories;
999 current_entry_indexes_ = current_entry_indexes; 1001 current_entry_indexes_ = current_entry_indexes;
1000 CaptureDump(); 1002 CaptureDump();
1001 } 1003 }
1002 1004
1003 void BlinkTestRunner::OnReset() { 1005 void BlinkTestRunner::OnReset() {
1004 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces()->ResetAll(); 1006 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces()->ResetAll();
1005 Reset(); 1007 Reset(true /* for_new_test */);
1006 // Navigating to about:blank will make sure that no new loads are initiated 1008 // Navigating to about:blank will make sure that no new loads are initiated
1007 // by the renderer. 1009 // by the renderer.
1008 render_view()->GetWebView()->mainFrame()->loadRequest( 1010 render_view()->GetWebView()->mainFrame()->loadRequest(
1009 WebURLRequest(GURL(url::kAboutBlankURL))); 1011 WebURLRequest(GURL(url::kAboutBlankURL)));
1010 Send(new ShellViewHostMsg_ResetDone(routing_id())); 1012 Send(new ShellViewHostMsg_ResetDone(routing_id()));
1011 } 1013 }
1012 1014
1013 void BlinkTestRunner::OnNotifyDone() { 1015 void BlinkTestRunner::OnNotifyDone() {
1014 render_view()->GetWebView()->mainFrame()->executeScript( 1016 render_view()->GetWebView()->mainFrame()->executeScript(
1015 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); 1017 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();")));
(...skipping 16 matching lines...) Expand all
1032 get_bluetooth_events_callbacks_.pop_front(); 1034 get_bluetooth_events_callbacks_.pop_front();
1033 callback.Run(events); 1035 callback.Run(events);
1034 } 1036 }
1035 1037
1036 void BlinkTestRunner::ReportLeakDetectionResult( 1038 void BlinkTestRunner::ReportLeakDetectionResult(
1037 const LeakDetectionResult& report) { 1039 const LeakDetectionResult& report) {
1038 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); 1040 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report));
1039 } 1041 }
1040 1042
1041 } // namespace content 1043 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698