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

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

Issue 1950323002: Refactor web shell integration tests utilities. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean up import/include Created 4 years, 7 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
Index: ios/web/shell/test/web_shell_navigation_egtest.mm
diff --git a/ios/web/shell/test/web_shell_navigation_egtest.mm b/ios/web/shell/test/web_shell_navigation_egtest.mm
index d48ba1903da9cb3156aad17879903ce16dcf7c2c..174597e826888a1f83b705b320dc89ad771608dc 100644
--- a/ios/web/shell/test/web_shell_navigation_egtest.mm
+++ b/ios/web/shell/test/web_shell_navigation_egtest.mm
@@ -9,11 +9,12 @@
#import <EarlGrey/EarlGrey.h>
#include "base/strings/sys_string_conversions.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"
-#include "ios/web/shell/test/navigation_test_util.h"
-#import "ios/web/shell/test/shell_matchers.h"
-#import "ios/web/shell/test/web_view_matchers.h"
+#include "ios/web/public/test/navigation_test_util.h"
+#include "ios/web/shell/test/app/web_shell_test_util.h"
+#import "ios/web/shell/test/earl_grey/shell_matchers.h"
// Navigation test cases for the web shell. These are Earl Grey integration
// tests, which are based on XCTest.
@@ -26,7 +27,9 @@
// Set up called once for the class.
+ (void)setUp {
[super setUp];
- [[EarlGrey selectElementWithMatcher:web::webViewContainingText(@"Chromium")]
+ web::WebState* webState = web::web_shell_test_util::GetCurrentWebState();
+ [[EarlGrey selectElementWithMatcher:web::webViewContainingText(@"Chromium",
+ webState)]
assertWithMatcher:grey_notNil()];
web::test::HttpServer& server = web::test::HttpServer::GetSharedInstance();
server.StartOrDie();
@@ -62,26 +65,34 @@
web::test::SetUpSimpleHttpServer(responses);
- web::navigation_test_util::LoadUrl(URL1);
+ web::WebState* webState = web::web_shell_test_util::GetCurrentWebState();
- [[EarlGrey selectElementWithMatcher:web::webViewContainingText(response1)]
+ web::navigation_test_util::LoadUrl(webState, URL1);
+
+ [[EarlGrey
+ selectElementWithMatcher:web::webViewContainingText(response1, webState)]
Eugene But (OOO till 7-30) 2016/05/05 18:01:11 Can you keep the old web::webViewContainingText(NS
baxley 2016/05/05 18:33:18 Just to clarify, you're suggesting to have (I shor
Eugene But (OOO till 7-30) 2016/05/05 18:50:32 Correct. |shellMatcher(text)| implementation will
baxley 2016/05/05 21:13:53 Done.
assertWithMatcher:grey_notNil()];
- web::navigation_test_util::LoadUrl(URL2);
+ web::navigation_test_util::LoadUrl(webState, URL2);
- [[EarlGrey selectElementWithMatcher:web::webViewContainingText(response2)]
+ [[EarlGrey
+ selectElementWithMatcher:web::webViewContainingText(response2, webState)]
assertWithMatcher:grey_notNil()];
- [[EarlGrey selectElementWithMatcher:web::backButton()]
+ //[[EarlGrey selectElementWithMatcher:web::backButton()]
+ [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Back")]
Eugene But (OOO till 7-30) 2016/05/05 18:01:11 Why? Old code was more readable and shorter.
baxley 2016/05/05 18:33:18 This was inadvertent, I thought I was editing a di
baxley 2016/05/05 21:13:53 Done.
performAction:grey_tap()];
- [[EarlGrey selectElementWithMatcher:web::webViewContainingText(response1)]
+ [[EarlGrey
+ selectElementWithMatcher:web::webViewContainingText(response1, webState)]
assertWithMatcher:grey_notNil()];
- [[EarlGrey selectElementWithMatcher:web::forwardButton()]
+ //[[EarlGrey selectElementWithMatcher:web::forwardButton()]
+ [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Forward")]
performAction:grey_tap()];
- [[EarlGrey selectElementWithMatcher:web::webViewContainingText(response2)]
+ [[EarlGrey
+ selectElementWithMatcher:web::webViewContainingText(response2, webState)]
assertWithMatcher:grey_notNil()];
}

Powered by Google App Engine
This is Rietveld 408576698