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

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

Issue 2686683004: ABANDONED CL: WaitForChildFrameSurfaceReady to avoid flaky test hangs. (Closed)
Patch Set: Created 3 years, 10 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 15 matching lines...) Expand all
26 #include "url/gurl.h" 26 #include "url/gurl.h"
27 27
28 namespace cc { 28 namespace cc {
29 class SurfaceManager; 29 class SurfaceManager;
30 } 30 }
31 31
32 namespace content { 32 namespace content {
33 33
34 class FrameTreeNode; 34 class FrameTreeNode;
35 class RenderFrameHost; 35 class RenderFrameHost;
36 class RenderWidgetHostViewChildFrame;
37 class Shell; 36 class Shell;
38 class SiteInstance; 37 class SiteInstance;
39 class ToRenderFrameHost; 38 class ToRenderFrameHost;
40 39
41 // Navigates the frame represented by |node| to |url|, blocking until the 40 // Navigates the frame represented by |node| to |url|, blocking until the
42 // navigation finishes. 41 // navigation finishes.
43 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url); 42 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url);
44 43
45 // Sets the DialogManager to proceed by default or not when showing a 44 // Sets the DialogManager to proceed by default or not when showing a
46 // BeforeUnload dialog. 45 // BeforeUnload dialog.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void RequestBeginning(net::URLRequest* request, 110 void RequestBeginning(net::URLRequest* request,
112 content::ResourceContext* resource_context, 111 content::ResourceContext* resource_context,
113 content::AppCacheService* appcache_service, 112 content::AppCacheService* appcache_service,
114 ResourceType resource_type, 113 ResourceType resource_type,
115 std::vector<std::unique_ptr<content::ResourceThrottle>>* 114 std::vector<std::unique_ptr<content::ResourceThrottle>>*
116 throttles) override; 115 throttles) override;
117 116
118 GURL url_; 117 GURL url_;
119 }; 118 };
120 119
121 // Helper class to assist with hit testing surfaces in multiple processes.
122 // WaitForSurfaceReady() will only return after a Surface from |target_view|
123 // has been composited in the top-level frame's Surface. At that point,
124 // browser process hit testing to target_view's Surface can succeed.
125 class SurfaceHitTestReadyNotifier {
126 public:
127 SurfaceHitTestReadyNotifier(RenderWidgetHostViewChildFrame* target_view);
128 ~SurfaceHitTestReadyNotifier() {}
129
130 void WaitForSurfaceReady();
131
132 private:
133 bool ContainsSurfaceId(cc::SurfaceId container_surface_id);
134
135 cc::SurfaceManager* surface_manager_;
136 cc::SurfaceId root_surface_id_;
137 RenderWidgetHostViewChildFrame* target_view_;
138
139 DISALLOW_COPY_AND_ASSIGN(SurfaceHitTestReadyNotifier);
140 };
141
142 // Helper for mocking choosing a file via a file dialog. 120 // Helper for mocking choosing a file via a file dialog.
143 class FileChooserDelegate : public WebContentsDelegate { 121 class FileChooserDelegate : public WebContentsDelegate {
144 public: 122 public:
145 // Constructs a WebContentsDelegate that mocks a file dialog. 123 // Constructs a WebContentsDelegate that mocks a file dialog.
146 // The mocked file dialog will always reply that the user selected |file|. 124 // The mocked file dialog will always reply that the user selected |file|.
147 FileChooserDelegate(const base::FilePath& file); 125 FileChooserDelegate(const base::FilePath& file);
148 126
149 // Implementation of WebContentsDelegate::RunFileChooser. 127 // Implementation of WebContentsDelegate::RunFileChooser.
150 void RunFileChooser(RenderFrameHost* render_frame_host, 128 void RunFileChooser(RenderFrameHost* render_frame_host,
151 const FileChooserParams& params) override; 129 const FileChooserParams& params) override;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 179
202 // The RunLoop used to spin the message loop. 180 // The RunLoop used to spin the message loop.
203 base::RunLoop run_loop_; 181 base::RunLoop run_loop_;
204 182
205 DISALLOW_COPY_AND_ASSIGN(UrlCommitObserver); 183 DISALLOW_COPY_AND_ASSIGN(UrlCommitObserver);
206 }; 184 };
207 185
208 } // namespace content 186 } // namespace content
209 187
210 #endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ 188 #endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_
OLDNEW
« no previous file with comments | « content/public/test/browser_test_utils.cc ('k') | content/test/content_browser_test_utils_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698