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

Side by Side Diff: ios/chrome/browser/web/navigation_egtest.mm

Issue 2890003002: [ObjC ARC] Converts ios/chrome/browser/web:eg_tests to ARC. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
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 <XCTest/XCTest.h> 5 #import <XCTest/XCTest.h>
6 6
7 #include "base/ios/ios_util.h" 7 #include "base/ios/ios_util.h"
8 #include "components/strings/grit/components_strings.h" 8 #include "components/strings/grit/components_strings.h"
9 #include "ios/chrome/test/app/web_view_interaction_test_util.h" 9 #include "ios/chrome/test/app/web_view_interaction_test_util.h"
10 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" 10 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
11 #import "ios/chrome/test/earl_grey/chrome_matchers.h" 11 #import "ios/chrome/test/earl_grey/chrome_matchers.h"
12 #import "ios/chrome/test/earl_grey/chrome_test_case.h" 12 #import "ios/chrome/test/earl_grey/chrome_test_case.h"
13 #import "ios/web/public/test/http_server.h" 13 #import "ios/web/public/test/http_server.h"
14 #include "ios/web/public/test/http_server_util.h" 14 #include "ios/web/public/test/http_server_util.h"
15 #include "ios/web/public/test/response_providers/data_response_provider.h" 15 #include "ios/web/public/test/response_providers/data_response_provider.h"
16 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
17 17
18 #if !defined(__has_feature) || !__has_feature(objc_arc)
19 #error "This file requires ARC support."
20 #endif
21
18 using chrome_test_util::BackButton; 22 using chrome_test_util::BackButton;
19 using chrome_test_util::ForwardButton; 23 using chrome_test_util::ForwardButton;
20 using chrome_test_util::TapWebViewElementWithId; 24 using chrome_test_util::TapWebViewElementWithId;
21 using chrome_test_util::WebViewContainingText; 25 using chrome_test_util::WebViewContainingText;
22 26
23 namespace { 27 namespace {
24 28
25 // URL for the test window.history.go() test file. The page at this URL 29 // URL for the test window.history.go() test file. The page at this URL
26 // contains several buttons that trigger window.history commands. Additionally 30 // contains several buttons that trigger window.history commands. Additionally
27 // the page contains several divs used to display the state of the page: 31 // the page contains several divs used to display the state of the page:
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 638
635 - (void)addHashChangeListenerWithContent:(std::string)content { 639 - (void)addHashChangeListenerWithContent:(std::string)content {
636 NSString* const script = 640 NSString* const script =
637 [NSString stringWithFormat: 641 [NSString stringWithFormat:
638 @"document.body.innerHTML = '%s';" 642 @"document.body.innerHTML = '%s';"
639 "window.addEventListener('hashchange', function(event) {" 643 "window.addEventListener('hashchange', function(event) {"
640 " document.body.innerHTML = '%s';" 644 " document.body.innerHTML = '%s';"
641 "});", 645 "});",
642 kNoHashChangeText, content.c_str()]; 646 kNoHashChangeText, content.c_str()];
643 647
644 NSError* error = nil; 648 __unsafe_unretained NSError* error = nil;
645 chrome_test_util::ExecuteJavaScript(script, &error); 649 chrome_test_util::ExecuteJavaScript(script, &error);
646 } 650 }
647 651
648 - (void)verifyBackAndForwardAfterRedirect:(std::string)redirectLabel { 652 - (void)verifyBackAndForwardAfterRedirect:(std::string)redirectLabel {
649 const GURL indexURL(web::test::HttpServer::MakeUrl(kRedirectIndexURL)); 653 const GURL indexURL(web::test::HttpServer::MakeUrl(kRedirectIndexURL));
650 const GURL destinationURL(web::test::HttpServer::MakeUrl(kDestinationURL)); 654 const GURL destinationURL(web::test::HttpServer::MakeUrl(kDestinationURL));
651 const GURL lastURL(web::test::HttpServer::MakeUrl(kLastURL)); 655 const GURL lastURL(web::test::HttpServer::MakeUrl(kLastURL));
652 656
653 // Load index, tap on redirect link, and assert that the page is redirected 657 // Load index, tap on redirect link, and assert that the page is redirected
654 // to the proper destination. 658 // to the proper destination.
(...skipping 20 matching lines...) Expand all
675 // Navigate forward and assert the the resulting page is the proper 679 // Navigate forward and assert the the resulting page is the proper
676 // destination. 680 // destination.
677 [[EarlGrey selectElementWithMatcher:ForwardButton()] 681 [[EarlGrey selectElementWithMatcher:ForwardButton()]
678 performAction:grey_tap()]; 682 performAction:grey_tap()];
679 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( 683 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText(
680 destinationURL.GetContent())] 684 destinationURL.GetContent())]
681 assertWithMatcher:grey_notNil()]; 685 assertWithMatcher:grey_notNil()];
682 } 686 }
683 687
684 @end 688 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/web/js_print_egtest.mm ('k') | ios/chrome/browser/web/progress_indicator_egtest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698