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

Side by Side Diff: content/test/test_frame_navigation_observer.h

Issue 248963007: Perform navigation policy check on UI thread for --site-per-process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on ToT. Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_TEST_TEST_FRAME_NAVIGATION_OBSERVER_H_
6 #define CONTENT_TEST_TEST_FRAME_NAVIGATION_OBSERVER_H_
7
8 #include <set>
9
10 #include "base/callback.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/test/test_utils.h"
15
16 class GURL;
17
18 namespace content {
19 class FrameTreeNode;
20 class RenderFrameHostImpl;
21 class WebContents;
22 struct LoadCommittedDetails;
23
24 // For content_browsertests, which run on the UI thread, run a second
25 // MessageLoop and quit when the navigation in a specific frame completes
26 // loading.
27 class TestFrameNavigationObserver : public WebContentsObserver {
28 public:
29 // Create and register a new TestFrameNavigationObserver which will track
30 // navigations performed in the specified |node| of the frame tree.
31 TestFrameNavigationObserver(FrameTreeNode* node, int number_of_navigations);
32 // As above but waits for one navigation.
33 explicit TestFrameNavigationObserver(FrameTreeNode* node);
34
35 virtual ~TestFrameNavigationObserver();
36
37 // Runs a nested message loop and blocks until the expected number of
38 // navigations are complete.
39 void Wait();
40
41 private:
42 // WebContentsObserver
43 virtual void DidStartProvisionalLoadForFrame(
44 int64 frame_id,
45 int64 parent_frame_id,
46 bool is_main_frame,
47 const GURL& validated_url,
48 bool is_error_page,
49 bool is_iframe_srcdoc,
50 RenderViewHost* render_view_host) OVERRIDE;
51 virtual void DidNavigateAnyFrame(
52 const LoadCommittedDetails& details,
53 const FrameNavigateParams& params) OVERRIDE;
54
55 // The id of the FrameTreeNode in which navigations are peformed.
56 int frame_tree_node_id_;
57
58 // If true the navigation has started.
59 bool navigation_started_;
60
61 // The number of navigations that have been completed.
62 int navigations_completed_;
63
64 // The number of navigations to wait for.
65 int number_of_navigations_;
66
67 // The MessageLoopRunner used to spin the message loop.
68 scoped_refptr<MessageLoopRunner> message_loop_runner_;
69
70 DISALLOW_COPY_AND_ASSIGN(TestFrameNavigationObserver);
71 };
72
73 } // namespace content
74
75 #endif // CONTENT_TEST_TEST_FRAME_NAVIGATION_OBSERVER_H_
OLDNEW
« no previous file with comments | « content/test/content_browser_test_utils_internal.cc ('k') | content/test/test_frame_navigation_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698