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

Side by Side Diff: ios/chrome/browser/web/visible_url_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 <EarlGrey/EarlGrey.h> 5 #import <EarlGrey/EarlGrey.h>
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "components/version_info/version_info.h" 11 #include "components/version_info/version_info.h"
12 #include "ios/chrome/browser/chrome_url_constants.h" 12 #include "ios/chrome/browser/chrome_url_constants.h"
13 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" 13 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
14 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" 14 #include "ios/chrome/browser/ui/commands/ios_command_ids.h"
15 #include "ios/chrome/browser/ui/ui_util.h" 15 #include "ios/chrome/browser/ui/ui_util.h"
16 #import "ios/chrome/test/app/chrome_test_util.h" 16 #import "ios/chrome/test/app/chrome_test_util.h"
17 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" 17 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
18 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" 18 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
19 #import "ios/chrome/test/earl_grey/chrome_matchers.h" 19 #import "ios/chrome/test/earl_grey/chrome_matchers.h"
20 #import "ios/chrome/test/earl_grey/chrome_test_case.h" 20 #import "ios/chrome/test/earl_grey/chrome_test_case.h"
21 #import "ios/web/public/test/http_server.h" 21 #import "ios/web/public/test/http_server.h"
22 #include "ios/web/public/test/http_server_util.h" 22 #include "ios/web/public/test/http_server_util.h"
23 #include "ios/web/public/test/response_providers/html_response_provider.h" 23 #include "ios/web/public/test/response_providers/html_response_provider.h"
24 #include "ios/web/public/test/url_test_util.h" 24 #include "ios/web/public/test/url_test_util.h"
25 #include "url/gurl.h" 25 #include "url/gurl.h"
26 26
27 #if !defined(__has_feature) || !__has_feature(objc_arc)
28 #error "This file requires ARC support."
29 #endif
30
27 using chrome_test_util::WebViewContainingText; 31 using chrome_test_util::WebViewContainingText;
28 using chrome_test_util::OmniboxText; 32 using chrome_test_util::OmniboxText;
29 33
30 namespace { 34 namespace {
31 35
32 const char kTestPage1[] = "Test Page 1"; 36 const char kTestPage1[] = "Test Page 1";
33 const char kTestPage2[] = "Test Page 2"; 37 const char kTestPage2[] = "Test Page 2";
34 const char kTestPage3[] = "Test Page 3"; 38 const char kTestPage3[] = "Test Page 3";
35 const char kGoBackLink[] = "go-back"; 39 const char kGoBackLink[] = "go-back";
36 const char kGoForwardLink[] = "go-forward"; 40 const char kGoForwardLink[] = "go-forward";
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 // Tap the back button twice in the toolbar and wait for URL 1 to load. 517 // Tap the back button twice in the toolbar and wait for URL 1 to load.
514 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] 518 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()]
515 performAction:grey_tap()]; 519 performAction:grey_tap()];
516 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] 520 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()]
517 performAction:grey_tap()]; 521 performAction:grey_tap()];
518 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage1)] 522 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage1)]
519 assertWithMatcher:grey_notNil()]; 523 assertWithMatcher:grey_notNil()];
520 524
521 // Quickly (using chrome command) navigate forward twice and wait for 525 // Quickly (using chrome command) navigate forward twice and wait for
522 // kChromeUIVersionURL to load. 526 // kChromeUIVersionURL to load.
523 base::scoped_nsobject<GenericChromeCommand> forwardCommand( 527 GenericChromeCommand* forwardCommand =
524 [[GenericChromeCommand alloc] initWithTag:IDC_FORWARD]); 528 [[GenericChromeCommand alloc] initWithTag:IDC_FORWARD];
525 chrome_test_util::RunCommandWithActiveViewController(forwardCommand); 529 chrome_test_util::RunCommandWithActiveViewController(forwardCommand);
526 chrome_test_util::RunCommandWithActiveViewController(forwardCommand); 530 chrome_test_util::RunCommandWithActiveViewController(forwardCommand);
527 531
528 const std::string version = version_info::GetVersionNumber(); 532 const std::string version = version_info::GetVersionNumber();
529 [[EarlGrey selectElementWithMatcher:WebViewContainingText(version)] 533 [[EarlGrey selectElementWithMatcher:WebViewContainingText(version)]
530 assertWithMatcher:grey_notNil()]; 534 assertWithMatcher:grey_notNil()];
531 535
532 // Make sure that kChromeUIVersionURL URL is displayed in the omnibox. 536 // Make sure that kChromeUIVersionURL URL is displayed in the omnibox.
533 std::string expectedText = base::UTF16ToUTF8(web::GetDisplayTitleForUrl(URL)); 537 std::string expectedText = base::UTF16ToUTF8(web::GetDisplayTitleForUrl(URL));
534 [[EarlGrey selectElementWithMatcher:OmniboxText(expectedText)] 538 [[EarlGrey selectElementWithMatcher:OmniboxText(expectedText)]
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 - (BOOL)waitForServerToReceiveRequestWithURL:(GURL)URL { 590 - (BOOL)waitForServerToReceiveRequestWithURL:(GURL)URL {
587 return [[GREYCondition 591 return [[GREYCondition
588 conditionWithName:@"Wait for received request" 592 conditionWithName:@"Wait for received request"
589 block:^{ 593 block:^{
590 return _responseProvider->last_request_url() == URL ? YES 594 return _responseProvider->last_request_url() == URL ? YES
591 : NO; 595 : NO;
592 }] waitWithTimeout:10]; 596 }] waitWithTimeout:10];
593 } 597 }
594 598
595 @end 599 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/web/stop_loading_egtest.mm ('k') | ios/chrome/browser/web/window_open_by_dom_egtest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698