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

Side by Side Diff: content/test/content_browser_test_utils_internal.cc

Issue 2377453002: Deflake RaceCrossOriginNavigationAndSamePageHistoryNavigation test. (Closed)
Patch Set: Created 4 years, 2 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 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>
11 #include <set> 11 #include <set>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/test/test_timeouts.h" 15 #include "base/test/test_timeouts.h"
16 #include "base/threading/thread_task_runner_handle.h" 16 #include "base/threading/thread_task_runner_handle.h"
17 #include "cc/surfaces/surface.h" 17 #include "cc/surfaces/surface.h"
18 #include "cc/surfaces/surface_manager.h" 18 #include "cc/surfaces/surface_manager.h"
19 #include "content/browser/compositor/surface_utils.h" 19 #include "content/browser/compositor/surface_utils.h"
20 #include "content/browser/frame_host/cross_process_frame_connector.h" 20 #include "content/browser/frame_host/cross_process_frame_connector.h"
21 #include "content/browser/frame_host/frame_tree_node.h" 21 #include "content/browser/frame_host/frame_tree_node.h"
22 #include "content/browser/frame_host/navigator.h" 22 #include "content/browser/frame_host/navigator.h"
23 #include "content/browser/frame_host/render_frame_host_delegate.h"
23 #include "content/browser/frame_host/render_frame_proxy_host.h" 24 #include "content/browser/frame_host/render_frame_proxy_host.h"
24 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" 25 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
25 #include "content/browser/renderer_host/delegated_frame_host.h" 26 #include "content/browser/renderer_host/delegated_frame_host.h"
26 #include "content/browser/renderer_host/render_widget_host_view_base.h" 27 #include "content/browser/renderer_host/render_widget_host_view_base.h"
27 #include "content/public/browser/navigation_handle.h" 28 #include "content/public/browser/navigation_handle.h"
28 #include "content/public/browser/render_frame_host.h" 29 #include "content/public/browser/render_frame_host.h"
29 #include "content/public/browser/resource_dispatcher_host.h" 30 #include "content/public/browser/resource_dispatcher_host.h"
30 #include "content/public/browser/resource_throttle.h" 31 #include "content/public/browser/resource_throttle.h"
31 #include "content/public/common/file_chooser_file_info.h" 32 #include "content/public/common/file_chooser_file_info.h"
32 #include "content/public/common/file_chooser_params.h" 33 #include "content/public/common/file_chooser_params.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 const GURL& url) 365 const GURL& url)
365 : TestNavigationManager(web_contents, url), 366 : TestNavigationManager(web_contents, url),
366 filtering_frame_tree_node_id_(filtering_frame_tree_node_id) {} 367 filtering_frame_tree_node_id_(filtering_frame_tree_node_id) {}
367 368
368 bool FrameTestNavigationManager::ShouldMonitorNavigation( 369 bool FrameTestNavigationManager::ShouldMonitorNavigation(
369 NavigationHandle* handle) { 370 NavigationHandle* handle) {
370 return TestNavigationManager::ShouldMonitorNavigation(handle) && 371 return TestNavigationManager::ShouldMonitorNavigation(handle) &&
371 handle->GetFrameTreeNodeId() == filtering_frame_tree_node_id_; 372 handle->GetFrameTreeNodeId() == filtering_frame_tree_node_id_;
372 } 373 }
373 374
375 UrlCommitObserver::UrlCommitObserver(FrameTreeNode* frame_tree_node,
376 const GURL& url)
377 : content::WebContentsObserver(frame_tree_node->current_frame_host()
378 ->delegate()
379 ->GetAsWebContents()),
380 frame_tree_node_id_(frame_tree_node->frame_tree_node_id()),
381 url_(url),
382 message_loop_runner_(new MessageLoopRunner) {}
383
384 UrlCommitObserver::~UrlCommitObserver() {}
385
386 void UrlCommitObserver::Wait() {
387 message_loop_runner_->Run();
388 }
389
390 void UrlCommitObserver::DidFinishNavigation(
391 NavigationHandle* navigation_handle) {
392 if (navigation_handle->GetURL() == url_ &&
Charlie Reis 2016/09/26 20:58:38 Do we care about checking HasCommitted(), to exclu
nasko 2016/09/26 22:03:49 And also error pages - yeah, I meant to do it and
393 navigation_handle->GetFrameTreeNodeId() == frame_tree_node_id_) {
394 message_loop_runner_->Quit();
395 }
396 }
397
374 } // namespace content 398 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698