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

Unified Diff: ios/web/shell/test/pdf_egtest.mm

Issue 2448753002: Refactor wait_util so it isn't coupled to EarlGrey. (Closed)
Patch Set: compile 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/shell/test/earl_grey/shell_matchers.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/shell/test/pdf_egtest.mm
diff --git a/ios/web/shell/test/pdf_egtest.mm b/ios/web/shell/test/pdf_egtest.mm
index 04884c2227b982cc3c2ae77e7df169ad938f636d..f18f409d829d87c34d00358380766a51e8f1d6b8 100644
--- a/ios/web/shell/test/pdf_egtest.mm
+++ b/ios/web/shell/test/pdf_egtest.mm
@@ -5,7 +5,7 @@
#import <EarlGrey/EarlGrey.h>
#include "base/test/ios/wait_util.h"
-#include "ios/testing/earl_grey/wait_util.h"
+#include "ios/testing/wait_util.h"
#import "ios/web/public/test/earl_grey/web_view_matchers.h"
#import "ios/web/public/test/http_server.h"
#include "ios/web/public/test/http_server_util.h"
@@ -26,18 +26,10 @@ const char kTestPDFURL[] =
id<GREYMatcher> webViewWithPdf() {
web::WebState* web_state = web::shell_test_util::GetCurrentWebState();
MatchesBlock matches = ^BOOL(UIView* view) {
- __block BOOL did_succeed = NO;
- NSDate* deadline =
- [NSDate dateWithTimeIntervalSinceNow:testing::kWaitForUIElementTimeout];
- while ([[NSDate date] compare:deadline] != NSOrderedDescending) {
- if (web_state->GetContentsMimeType() == "application/pdf") {
- did_succeed = YES;
- break;
- }
- base::test::ios::SpinRunLoopWithMaxDelay(
- base::TimeDelta::FromSecondsD(testing::kSpinDelaySeconds));
- }
- return did_succeed;
+ return testing::WaitUntilConditionOrTimeout(
+ testing::kWaitForUIElementTimeout, ^{
+ return web_state->GetContentsMimeType() == "application/pdf";
+ });
};
DescribeToBlock describe = ^(id<GREYDescription> description) {
« no previous file with comments | « ios/web/shell/test/earl_grey/shell_matchers.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698