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

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

Issue 2377453002: Deflake RaceCrossOriginNavigationAndSamePageHistoryNavigation test. (Closed)
Patch Set: Add a HasCommitted check. 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 #ifndef CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ 5 #ifndef CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_
6 #define CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ 6 #define CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_
7 7
8 // A collection of functions designed for use with content_shell based browser 8 // A collection of functions designed for use with content_shell based browser
9 // tests internal to the content/ module. 9 // tests internal to the content/ module.
10 // Note: If a function here also works with browser_tests, it should be in 10 // Note: If a function here also works with browser_tests, it should be in
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 private: 167 private:
168 // TestNavigationManager: 168 // TestNavigationManager:
169 bool ShouldMonitorNavigation(NavigationHandle* handle) override; 169 bool ShouldMonitorNavigation(NavigationHandle* handle) override;
170 170
171 // Notifications are filtered so only this frame is monitored. 171 // Notifications are filtered so only this frame is monitored.
172 int filtering_frame_tree_node_id_; 172 int filtering_frame_tree_node_id_;
173 173
174 DISALLOW_COPY_AND_ASSIGN(FrameTestNavigationManager); 174 DISALLOW_COPY_AND_ASSIGN(FrameTestNavigationManager);
175 }; 175 };
176 176
177 // An observer that can wait for a specific URL to be committed in a specific
178 // frame.
179 // Note: it does not track the start of a navigation, unlike other observers.
180 class UrlCommitObserver : WebContentsObserver {
181 public:
182 explicit UrlCommitObserver(FrameTreeNode* frame_tree_node, const GURL& url);
183 ~UrlCommitObserver() override;
184
185 void Wait();
186
187 private:
188 void DidFinishNavigation(NavigationHandle* navigation_handle) override;
189
190 // The id of the FrameTreeNode in which navigations are peformed.
191 int frame_tree_node_id_;
192
193 // The URL this observer is expecting to be committed.
194 GURL url_;
195
196 // The MessageLoopRunner used to spin the message loop.
197 scoped_refptr<MessageLoopRunner> message_loop_runner_;
198
199 DISALLOW_COPY_AND_ASSIGN(UrlCommitObserver);
200 };
201
177 } // namespace content 202 } // namespace content
178 203
179 #endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ 204 #endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698