OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/test/earl_grey/chrome_assertions.h" |
| 6 |
| 7 #import <EarlGrey/EarlGrey.h> |
| 8 |
| 9 #include "base/format_macros.h" |
| 10 #import "ios/chrome/test/app/tab_test_util.h" |
| 11 #import "ios/testing/wait_util.h" |
| 12 |
| 13 namespace chrome_test_util { |
| 14 |
| 15 void AssertMainTabCount(NSUInteger expected_tab_count) { |
| 16 // Allow the UI to become idle, in case any tabs are being opened or closed. |
| 17 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; |
| 18 GREYAssert(testing::WaitUntilConditionOrTimeout( |
| 19 testing::kWaitForUIElementTimeout, |
| 20 ^{ |
| 21 return GetMainTabCount() == expected_tab_count; |
| 22 }), |
| 23 [NSString stringWithFormat:@"Did not receive %" PRIuNS " tabs", |
| 24 expected_tab_count]); |
| 25 } |
| 26 |
| 27 void AssertIncognitoTabCount(NSUInteger expected_tab_count) { |
| 28 // Allow the UI to become idle, in case any tabs are being opened or closed. |
| 29 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; |
| 30 ConditionBlock condition = ^{ |
| 31 return GetIncognitoTabCount() == expected_tab_count; |
| 32 }; |
| 33 GREYAssert( |
| 34 testing::WaitUntilConditionOrTimeout(testing::kWaitForUIElementTimeout, |
| 35 condition), |
| 36 [NSString stringWithFormat:@"Did not receive %" PRIuNS " incognito tabs", |
| 37 expected_tab_count]); |
| 38 } |
| 39 |
| 40 } // namespace chrome_test_util |
OLD | NEW |