| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/test/content_browser_test_utils_internal.h" | 5 #include "content/test/content_browser_test_utils_internal.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 28 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 29 #include "content/public/browser/navigation_handle.h" | 29 #include "content/public/browser/navigation_handle.h" |
| 30 #include "content/public/browser/render_frame_host.h" | 30 #include "content/public/browser/render_frame_host.h" |
| 31 #include "content/public/browser/resource_dispatcher_host.h" | 31 #include "content/public/browser/resource_dispatcher_host.h" |
| 32 #include "content/public/browser/resource_throttle.h" | 32 #include "content/public/browser/resource_throttle.h" |
| 33 #include "content/public/common/file_chooser_file_info.h" | 33 #include "content/public/common/file_chooser_file_info.h" |
| 34 #include "content/public/test/browser_test_utils.h" | 34 #include "content/public/test/browser_test_utils.h" |
| 35 #include "content/public/test/content_browser_test_utils.h" | 35 #include "content/public/test/content_browser_test_utils.h" |
| 36 #include "content/public/test/test_frame_navigation_observer.h" | 36 #include "content/public/test/test_frame_navigation_observer.h" |
| 37 #include "content/shell/browser/shell.h" | 37 #include "content/shell/browser/shell.h" |
| 38 #include "content/shell/browser/shell_javascript_dialog_manager.h" | |
| 39 #include "net/url_request/url_request.h" | 38 #include "net/url_request/url_request.h" |
| 40 | 39 |
| 41 namespace content { | 40 namespace content { |
| 42 | 41 |
| 43 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url) { | 42 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url) { |
| 44 TestFrameNavigationObserver observer(node); | 43 TestFrameNavigationObserver observer(node); |
| 45 NavigationController::LoadURLParams params(url); | 44 NavigationController::LoadURLParams params(url); |
| 46 params.transition_type = ui::PAGE_TRANSITION_LINK; | 45 params.transition_type = ui::PAGE_TRANSITION_LINK; |
| 47 params.frame_tree_node_id = node->frame_tree_node_id(); | 46 params.frame_tree_node_id = node->frame_tree_node_id(); |
| 48 node->navigator()->GetController()->LoadURLWithParams(params); | 47 node->navigator()->GetController()->LoadURLWithParams(params); |
| 49 observer.Wait(); | 48 observer.Wait(); |
| 50 } | 49 } |
| 51 | 50 |
| 52 void SetShouldProceedOnBeforeUnload(Shell* shell, bool proceed) { | |
| 53 ShellJavaScriptDialogManager* manager = | |
| 54 static_cast<ShellJavaScriptDialogManager*>( | |
| 55 shell->GetJavaScriptDialogManager(shell->web_contents())); | |
| 56 manager->set_should_proceed_on_beforeunload(proceed); | |
| 57 } | |
| 58 | |
| 59 RenderFrameHost* ConvertToRenderFrameHost(FrameTreeNode* frame_tree_node) { | 51 RenderFrameHost* ConvertToRenderFrameHost(FrameTreeNode* frame_tree_node) { |
| 60 return frame_tree_node->current_frame_host(); | 52 return frame_tree_node->current_frame_host(); |
| 61 } | 53 } |
| 62 | 54 |
| 63 FrameTreeVisualizer::FrameTreeVisualizer() { | 55 FrameTreeVisualizer::FrameTreeVisualizer() { |
| 64 } | 56 } |
| 65 | 57 |
| 66 FrameTreeVisualizer::~FrameTreeVisualizer() { | 58 FrameTreeVisualizer::~FrameTreeVisualizer() { |
| 67 } | 59 } |
| 68 | 60 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 NavigationHandle* navigation_handle) { | 389 NavigationHandle* navigation_handle) { |
| 398 if (navigation_handle->HasCommitted() && | 390 if (navigation_handle->HasCommitted() && |
| 399 !navigation_handle->IsErrorPage() && | 391 !navigation_handle->IsErrorPage() && |
| 400 navigation_handle->GetURL() == url_ && | 392 navigation_handle->GetURL() == url_ && |
| 401 navigation_handle->GetFrameTreeNodeId() == frame_tree_node_id_) { | 393 navigation_handle->GetFrameTreeNodeId() == frame_tree_node_id_) { |
| 402 run_loop_.Quit(); | 394 run_loop_.Quit(); |
| 403 } | 395 } |
| 404 } | 396 } |
| 405 | 397 |
| 406 } // namespace content | 398 } // namespace content |
| OLD | NEW |