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

Side by Side Diff: content/public/test/test_frame_navigation_observer.cc

Issue 2478583005: Browser tests for starting a drag-and-drop out of an OOPIF. (Closed)
Patch Set: Rebasing... Created 4 years, 1 month 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/test_frame_navigation_observer.h" 5 #include "content/public/test/test_frame_navigation_observer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "content/browser/frame_host/navigation_entry_impl.h" 11 #include "content/browser/frame_host/navigation_entry_impl.h"
12 #include "content/browser/frame_host/render_frame_host_impl.h" 12 #include "content/browser/frame_host/render_frame_host_impl.h"
13 #include "content/browser/renderer_host/render_view_host_impl.h" 13 #include "content/browser/renderer_host/render_view_host_impl.h"
14 #include "content/browser/web_contents/web_contents_impl.h" 14 #include "content/browser/web_contents/web_contents_impl.h"
15 #include "content/public/browser/web_contents_observer.h" 15 #include "content/public/browser/web_contents_observer.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 namespace content { 18 namespace content {
19 19
20 TestFrameNavigationObserver::TestFrameNavigationObserver( 20 TestFrameNavigationObserver::TestFrameNavigationObserver(RenderFrameHost* frame)
21 FrameTreeNode* node) 21 : WebContentsObserver(static_cast<RenderFrameHostImpl*>(frame)
22 : WebContentsObserver( 22 ->delegate()
23 node->current_frame_host()->delegate()->GetAsWebContents()), 23 ->GetAsWebContents()),
24 frame_tree_node_id_(node->frame_tree_node_id()), 24 frame_tree_node_id_(
25 static_cast<RenderFrameHostImpl*>(frame)->GetFrameTreeNodeId()),
25 navigation_started_(false), 26 navigation_started_(false),
26 has_committed_(false), 27 has_committed_(false),
27 wait_for_commit_(false), 28 wait_for_commit_(false),
28 message_loop_runner_(new MessageLoopRunner) { 29 message_loop_runner_(new MessageLoopRunner) {}
29 }
30 30
31 TestFrameNavigationObserver::~TestFrameNavigationObserver() { 31 TestFrameNavigationObserver::~TestFrameNavigationObserver() {}
32 }
33 32
34 void TestFrameNavigationObserver::Wait() { 33 void TestFrameNavigationObserver::Wait() {
35 wait_for_commit_ = false; 34 wait_for_commit_ = false;
36 message_loop_runner_->Run(); 35 message_loop_runner_->Run();
37 } 36 }
38 37
39 void TestFrameNavigationObserver::WaitForCommit() { 38 void TestFrameNavigationObserver::WaitForCommit() {
40 if (has_committed_) 39 if (has_committed_)
41 return; 40 return;
42 41
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 75
77 void TestFrameNavigationObserver::DidStopLoading() { 76 void TestFrameNavigationObserver::DidStopLoading() {
78 if (!navigation_started_) 77 if (!navigation_started_)
79 return; 78 return;
80 79
81 navigation_started_ = false; 80 navigation_started_ = false;
82 message_loop_runner_->Quit(); 81 message_loop_runner_->Quit();
83 } 82 }
84 83
85 } // namespace content 84 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698