| OLD | NEW |
| 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/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "components/strings/grit/components_strings.h" | 9 #include "components/strings/grit/components_strings.h" |
| 10 #include "ios/chrome/browser/ui/ui_util.h" | 10 #include "ios/chrome/browser/ui/ui_util.h" |
| 11 #include "ios/chrome/grit/ios_strings.h" | 11 #include "ios/chrome/grit/ios_strings.h" |
| 12 #include "ios/chrome/test/app/navigation_test_util.h" | 12 #include "ios/chrome/test/app/navigation_test_util.h" |
| 13 #import "ios/chrome/test/earl_grey/chrome_matchers.h" | 13 #import "ios/chrome/test/earl_grey/chrome_matchers.h" |
| 14 #import "ios/chrome/test/earl_grey/chrome_test_case.h" | 14 #import "ios/chrome/test/earl_grey/chrome_test_case.h" |
| 15 #import "ios/testing/wait_util.h" | 15 #import "ios/testing/wait_util.h" |
| 16 #import "ios/web/public/test/http_server.h" | 16 #import "ios/web/public/test/http_server.h" |
| 17 #include "ios/web/public/test/http_server_util.h" | 17 #include "ios/web/public/test/http_server_util.h" |
| 18 #import "ios/web/public/test/response_providers/http_auth_response_provider.h" | 18 #import "ios/web/public/test/response_providers/http_auth_response_provider.h" |
| 19 #include "ui/base/l10n/l10n_util_mac.h" | 19 #include "ui/base/l10n/l10n_util_mac.h" |
| 20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 21 | 21 |
| 22 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 23 #error "This file requires ARC support." |
| 24 #endif |
| 25 |
| 22 using testing::WaitUntilConditionOrTimeout; | 26 using testing::WaitUntilConditionOrTimeout; |
| 23 using testing::kWaitForPageLoadTimeout; | 27 using testing::kWaitForPageLoadTimeout; |
| 24 using chrome_test_util::WebViewContainingText; | 28 using chrome_test_util::WebViewContainingText; |
| 25 | 29 |
| 26 namespace { | 30 namespace { |
| 27 | 31 |
| 28 // Returns matcher for HTTP Authentication dialog. | 32 // Returns matcher for HTTP Authentication dialog. |
| 29 id<GREYMatcher> HttpAuthDialog() { | 33 id<GREYMatcher> HttpAuthDialog() { |
| 30 NSString* title = l10n_util::GetNSStringWithFixup(IDS_LOGIN_DIALOG_TITLE); | 34 NSString* title = l10n_util::GetNSStringWithFixup(IDS_LOGIN_DIALOG_TITLE); |
| 31 return chrome_test_util::StaticTextWithAccessibilityLabel(title); | 35 return chrome_test_util::StaticTextWithAccessibilityLabel(title); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 chrome_test_util::LoadUrl(URL); | 141 chrome_test_util::LoadUrl(URL); |
| 138 WaitForHttpAuthDialog(); | 142 WaitForHttpAuthDialog(); |
| 139 | 143 |
| 140 [[EarlGrey selectElementWithMatcher:chrome_test_util::CancelButton()] | 144 [[EarlGrey selectElementWithMatcher:chrome_test_util::CancelButton()] |
| 141 performAction:grey_tap()]; | 145 performAction:grey_tap()]; |
| 142 [[EarlGrey selectElementWithMatcher:HttpAuthDialog()] | 146 [[EarlGrey selectElementWithMatcher:HttpAuthDialog()] |
| 143 assertWithMatcher:grey_nil()]; | 147 assertWithMatcher:grey_nil()]; |
| 144 } | 148 } |
| 145 | 149 |
| 146 @end | 150 @end |
| OLD | NEW |