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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/test_frame_navigation_observer.h
diff --git a/content/test/test_frame_navigation_observer.h b/content/test/test_frame_navigation_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..4cccb34ebae1d177918d8097fa46eff0643a69b8
--- /dev/null
+++ b/content/test/test_frame_navigation_observer.h
@@ -0,0 +1,75 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_TEST_TEST_FRAME_NAVIGATION_OBSERVER_H_
+#define CONTENT_TEST_TEST_FRAME_NAVIGATION_OBSERVER_H_
+
+#include <set>
+
+#include "base/callback.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/public/browser/web_contents_observer.h"
+#include "content/public/test/test_utils.h"
+
+class GURL;
+
+namespace content {
+class FrameTreeNode;
+class RenderFrameHostImpl;
+class WebContents;
+struct LoadCommittedDetails;
+
+// For content_browsertests, which run on the UI thread, run a second
+// MessageLoop and quit when the navigation in a specific frame completes
+// loading.
+class TestFrameNavigationObserver : public WebContentsObserver {
+ public:
+ // Create and register a new TestFrameNavigationObserver which will track
+ // navigations performed in the specified |node| of the frame tree.
+ TestFrameNavigationObserver(FrameTreeNode* node, int number_of_navigations);
+ // As above but waits for one navigation.
+ explicit TestFrameNavigationObserver(FrameTreeNode* node);
+
+ virtual ~TestFrameNavigationObserver();
+
+ // Runs a nested message loop and blocks until the expected number of
+ // navigations are complete.
+ void Wait();
+
+ private:
+ // WebContentsObserver
+ virtual void DidStartProvisionalLoadForFrame(
+ int64 frame_id,
+ int64 parent_frame_id,
+ bool is_main_frame,
+ const GURL& validated_url,
+ bool is_error_page,
+ bool is_iframe_srcdoc,
+ RenderViewHost* render_view_host) OVERRIDE;
+ virtual void DidNavigateAnyFrame(
+ const LoadCommittedDetails& details,
+ const FrameNavigateParams& params) OVERRIDE;
+
+ // The id of the FrameTreeNode in which navigations are peformed.
+ int frame_tree_node_id_;
+
+ // If true the navigation has started.
+ bool navigation_started_;
+
+ // The number of navigations that have been completed.
+ int navigations_completed_;
+
+ // The number of navigations to wait for.
+ int number_of_navigations_;
+
+ // The MessageLoopRunner used to spin the message loop.
+ scoped_refptr<MessageLoopRunner> message_loop_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestFrameNavigationObserver);
+};
+
+} // namespace content
+
+#endif // CONTENT_TEST_TEST_FRAME_NAVIGATION_OBSERVER_H_
« 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