| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/layout_test/blink_test_controller.h" | 5 #include "content/shell/browser/layout_test/blink_test_controller.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <iostream> | 9 #include <iostream> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 void BlinkTestController::OnLoadURLForFrame(const GURL& url, | 819 void BlinkTestController::OnLoadURLForFrame(const GURL& url, |
| 820 const std::string& frame_name) { | 820 const std::string& frame_name) { |
| 821 main_window_->LoadURLForFrame(url, frame_name); | 821 main_window_->LoadURLForFrame(url, frame_name); |
| 822 } | 822 } |
| 823 | 823 |
| 824 void BlinkTestController::OnCaptureSessionHistory() { | 824 void BlinkTestController::OnCaptureSessionHistory() { |
| 825 std::vector<int> routing_ids; | 825 std::vector<int> routing_ids; |
| 826 std::vector<std::vector<PageState> > session_histories; | 826 std::vector<std::vector<PageState> > session_histories; |
| 827 std::vector<unsigned> current_entry_indexes; | 827 std::vector<unsigned> current_entry_indexes; |
| 828 | 828 |
| 829 RenderViewHost* render_view_host = | 829 RenderFrameHost* render_frame_host = |
| 830 main_window_->web_contents()->GetRenderViewHost(); | 830 main_window_->web_contents()->GetMainFrame(); |
| 831 | 831 |
| 832 for (std::vector<Shell*>::iterator window = Shell::windows().begin(); | 832 for (auto* window : Shell::windows()) { |
| 833 window != Shell::windows().end(); | 833 WebContents* web_contents = window->web_contents(); |
| 834 ++window) { | |
| 835 WebContents* web_contents = (*window)->web_contents(); | |
| 836 // Only capture the history from windows in the same process as the main | 834 // Only capture the history from windows in the same process as the main |
| 837 // window. During layout tests, we only use two processes when an | 835 // window. During layout tests, we only use two processes when an |
| 838 // devtools window is open. | 836 // devtools window is open. |
| 839 if (render_view_host->GetProcess() != | 837 auto* process = web_contents->GetMainFrame()->GetProcess(); |
| 840 web_contents->GetRenderViewHost()->GetProcess()) { | 838 if (render_frame_host->GetProcess() != process) |
| 841 continue; | 839 continue; |
| 842 } | 840 |
| 843 routing_ids.push_back(web_contents->GetRenderViewHost()->GetRoutingID()); | 841 routing_ids.push_back(web_contents->GetRenderViewHost()->GetRoutingID()); |
| 844 current_entry_indexes.push_back( | 842 current_entry_indexes.push_back( |
| 845 web_contents->GetController().GetCurrentEntryIndex()); | 843 web_contents->GetController().GetCurrentEntryIndex()); |
| 846 std::vector<PageState> history; | 844 std::vector<PageState> history; |
| 847 for (int entry = 0; entry < web_contents->GetController().GetEntryCount(); | 845 for (int entry = 0; entry < web_contents->GetController().GetEntryCount(); |
| 848 ++entry) { | 846 ++entry) { |
| 849 PageState state = web_contents->GetController().GetEntryAtIndex(entry)-> | 847 PageState state = web_contents->GetController().GetEntryAtIndex(entry)-> |
| 850 GetPageState(); | 848 GetPageState(); |
| 851 if (!state.IsValid()) { | 849 if (!state.IsValid()) { |
| 852 state = PageState::CreateFromURL( | 850 state = PageState::CreateFromURL( |
| 853 web_contents->GetController().GetEntryAtIndex(entry)->GetURL()); | 851 web_contents->GetController().GetEntryAtIndex(entry)->GetURL()); |
| 854 } | 852 } |
| 855 history.push_back(state); | 853 history.push_back(state); |
| 856 } | 854 } |
| 857 session_histories.push_back(history); | 855 session_histories.push_back(history); |
| 858 } | 856 } |
| 859 | 857 |
| 858 RenderViewHost* render_view_host = |
| 859 main_window_->web_contents()->GetRenderViewHost(); |
| 860 Send(new ShellViewMsg_SessionHistory(render_view_host->GetRoutingID(), | 860 Send(new ShellViewMsg_SessionHistory(render_view_host->GetRoutingID(), |
| 861 routing_ids, | 861 routing_ids, |
| 862 session_histories, | 862 session_histories, |
| 863 current_entry_indexes)); | 863 current_entry_indexes)); |
| 864 } | 864 } |
| 865 | 865 |
| 866 void BlinkTestController::OnCloseRemainingWindows() { | 866 void BlinkTestController::OnCloseRemainingWindows() { |
| 867 DevToolsAgentHost::DetachAllClients(); | 867 DevToolsAgentHost::DetachAllClients(); |
| 868 std::vector<Shell*> open_windows(Shell::windows()); | 868 std::vector<Shell*> open_windows(Shell::windows()); |
| 869 Shell* devtools_shell = devtools_frontend_ ? | 869 Shell* devtools_shell = devtools_frontend_ ? |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 } else { | 944 } else { |
| 945 printer_->AddErrorMessage(base::StringPrintf( | 945 printer_->AddErrorMessage(base::StringPrintf( |
| 946 "FAIL: Unexpected sendBluetoothManualChooserEvent() event name '%s'.", | 946 "FAIL: Unexpected sendBluetoothManualChooserEvent() event name '%s'.", |
| 947 event_name.c_str())); | 947 event_name.c_str())); |
| 948 return; | 948 return; |
| 949 } | 949 } |
| 950 bluetooth_chooser_factory_->SendEvent(event, argument); | 950 bluetooth_chooser_factory_->SendEvent(event, argument); |
| 951 } | 951 } |
| 952 | 952 |
| 953 } // namespace content | 953 } // namespace content |
| OLD | NEW |