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: ios/chrome/test/earl_grey/chrome_test_case.mm

Issue 2652343005: Add a timeout on the EG DrainUntilIdle (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #import "ios/chrome/test/earl_grey/chrome_test_case.h" 5 #import "ios/chrome/test/earl_grey/chrome_test_case.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 8
9 #import <EarlGrey/EarlGrey.h> 9 #import <EarlGrey/EarlGrey.h>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 @"testSignInOneUser", // SigninInteractionControllerTestCase 63 @"testSignInOneUser", // SigninInteractionControllerTestCase
64 @"testSwitchTabs", // StackViewTestCase 64 @"testSwitchTabs", // StackViewTestCase
65 @"testTabStripSwitchTabs", // TabStripTestCase 65 @"testTabStripSwitchTabs", // TabStripTestCase
66 @"testTabHistoryMenu", // TabHistoryPopupControllerTestCase 66 @"testTabHistoryMenu", // TabHistoryPopupControllerTestCase
67 @"testEnteringTabSwitcher", // TabSwitcherControllerTestCase 67 @"testEnteringTabSwitcher", // TabSwitcherControllerTestCase
68 @"testEnterURL", // ToolbarTestCase 68 @"testEnterURL", // ToolbarTestCase
69 @"testOpenAndCloseToolsMenu", // ToolsPopupMenuTestCase 69 @"testOpenAndCloseToolsMenu", // ToolsPopupMenuTestCase
70 @"testUserFeedbackPageOpenPrivacyPolicy", // UserFeedbackTestCase 70 @"testUserFeedbackPageOpenPrivacyPolicy", // UserFeedbackTestCase
71 @"testVersion", // WebUITestCase 71 @"testVersion", // WebUITestCase
72 ]; 72 ];
73
74 const CFTimeInterval kDrainTimeout = 5;
73 } // namespace 75 } // namespace
74 76
75 @interface ChromeTestCase () { 77 @interface ChromeTestCase () {
76 // Block to be executed during object tearDown. 78 // Block to be executed during object tearDown.
77 base::mac::ScopedBlock<ProceduralBlock> _tearDownHandler; 79 base::mac::ScopedBlock<ProceduralBlock> _tearDownHandler;
78 80
79 BOOL _isHTTPServerStopped; 81 BOOL _isHTTPServerStopped;
80 BOOL _isMockAuthenticationDisabled; 82 BOOL _isMockAuthenticationDisabled;
81 } 83 }
82 84
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 DCHECK(!_tearDownHandler); 199 DCHECK(!_tearDownHandler);
198 _tearDownHandler.reset([tearDownHandler copy]); 200 _tearDownHandler.reset([tearDownHandler copy]);
199 } 201 }
200 202
201 + (void)removeAnyOpenMenusAndInfoBars { 203 + (void)removeAnyOpenMenusAndInfoBars {
202 chrome_test_util::RemoveAllInfoBars(); 204 chrome_test_util::RemoveAllInfoBars();
203 chrome_test_util::ClearPresentedState(); 205 chrome_test_util::ClearPresentedState();
204 // After programatically removing UI elements, allow Earl Grey's 206 // After programatically removing UI elements, allow Earl Grey's
205 // UI synchronization to become idle, so subsequent steps won't start before 207 // UI synchronization to become idle, so subsequent steps won't start before
206 // the UI is in a good state. 208 // the UI is in a good state.
207 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; 209 [[GREYUIThreadExecutor sharedInstance]
210 drainUntilIdleWithTimeout:kDrainTimeout];
208 } 211 }
209 212
210 + (void)closeAllTabs { 213 + (void)closeAllTabs {
211 chrome_test_util::CloseAllTabs(); 214 chrome_test_util::CloseAllTabs();
212 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; 215 [[GREYUIThreadExecutor sharedInstance]
216 drainUntilIdleWithTimeout:kDrainTimeout];
213 } 217 }
214 218
215 - (void)disableMockAuthentication { 219 - (void)disableMockAuthentication {
216 // Enforce that disableMockAuthentication can only be called once. 220 // Enforce that disableMockAuthentication can only be called once.
217 DCHECK(!_isMockAuthenticationDisabled); 221 DCHECK(!_isMockAuthenticationDisabled);
218 [[self class] disableMockAuthentication]; 222 [[self class] disableMockAuthentication];
219 _isMockAuthenticationDisabled = YES; 223 _isMockAuthenticationDisabled = YES;
220 } 224 }
221 225
222 - (void)stopHTTPServer { 226 - (void)stopHTTPServer {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 [NSInvocation invocationWithMethodSignature:methodSignature]; 294 [NSInvocation invocationWithMethodSignature:methodSignature];
291 invocation.selector = selector; 295 invocation.selector = selector;
292 [multitaskingTestNames addObject:invocation]; 296 [multitaskingTestNames addObject:invocation];
293 } 297 }
294 } 298 }
295 free(methods); 299 free(methods);
296 return multitaskingTestNames; 300 return multitaskingTestNames;
297 } 301 }
298 302
299 @end 303 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698