| 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/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "ios/chrome/browser/ui/ui_util.h" | 11 #include "ios/chrome/browser/ui/ui_util.h" |
| 12 #include "ios/chrome/test/app/navigation_test_util.h" | 12 #include "ios/chrome/test/app/navigation_test_util.h" |
| 13 #include "ios/chrome/test/app/web_view_interaction_test_util.h" | 13 #include "ios/chrome/test/app/web_view_interaction_test_util.h" |
| 14 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" | 14 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" |
| 15 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" |
| 15 #import "ios/chrome/test/earl_grey/chrome_matchers.h" | 16 #import "ios/chrome/test/earl_grey/chrome_matchers.h" |
| 16 #import "ios/chrome/test/earl_grey/chrome_test_case.h" | 17 #import "ios/chrome/test/earl_grey/chrome_test_case.h" |
| 17 #include "ios/chrome/test/earl_grey/chrome_util.h" | |
| 18 #import "ios/testing/earl_grey/disabled_test_macros.h" | 18 #import "ios/testing/earl_grey/disabled_test_macros.h" |
| 19 #import "ios/third_party/material_components_ios/src/components/ProgressView/src
/MaterialProgressView.h" | 19 #import "ios/third_party/material_components_ios/src/components/ProgressView/src
/MaterialProgressView.h" |
| 20 #import "ios/web/public/test/http_server.h" | 20 #import "ios/web/public/test/http_server.h" |
| 21 #import "ios/web/public/test/http_server_util.h" | 21 #import "ios/web/public/test/http_server_util.h" |
| 22 #include "ios/web/public/test/response_providers/html_response_provider.h" | 22 #include "ios/web/public/test/response_providers/html_response_provider.h" |
| 23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 24 | 24 |
| 25 using chrome_test_util::WebViewContainingText; | 25 using chrome_test_util::WebViewContainingText; |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 chrome_test_util::LoadUrl(infinitePendingURL); | 150 chrome_test_util::LoadUrl(infinitePendingURL); |
| 151 | 151 |
| 152 // Wait until the page is half loaded. | 152 // Wait until the page is half loaded. |
| 153 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kPageText)] | 153 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kPageText)] |
| 154 assertWithMatcher:grey_notNil()]; | 154 assertWithMatcher:grey_notNil()]; |
| 155 | 155 |
| 156 // Verify progress view visible and halfway progress. | 156 // Verify progress view visible and halfway progress. |
| 157 [[EarlGrey selectElementWithMatcher:ProgressViewWithProgress(0.5)] | 157 [[EarlGrey selectElementWithMatcher:ProgressViewWithProgress(0.5)] |
| 158 assertWithMatcher:grey_sufficientlyVisible()]; | 158 assertWithMatcher:grey_sufficientlyVisible()]; |
| 159 | 159 |
| 160 // Verify toolbar visible. | 160 [ChromeEarlGreyUI waitForToolbarVisible:YES]; |
| 161 chrome_test_util::AssertToolbarVisible(); | |
| 162 } | 161 } |
| 163 | 162 |
| 164 // Tests that the progress indicator is shown and has expected progress value | 163 // Tests that the progress indicator is shown and has expected progress value |
| 165 // after a form is submitted, and the toolbar is visible. | 164 // after a form is submitted, and the toolbar is visible. |
| 166 - (void)testProgressIndicatorShownOnFormSubmit { | 165 - (void)testProgressIndicatorShownOnFormSubmit { |
| 167 if (IsIPadIdiom()) { | 166 if (IsIPadIdiom()) { |
| 168 EARL_GREY_TEST_SKIPPED(@"Skipped for iPad (no progress view in tablet)"); | 167 EARL_GREY_TEST_SKIPPED(@"Skipped for iPad (no progress view in tablet)"); |
| 169 } | 168 } |
| 170 | 169 |
| 171 const GURL formURL = web::test::HttpServer::MakeUrl(kFormURL); | 170 const GURL formURL = web::test::HttpServer::MakeUrl(kFormURL); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 190 chrome_test_util::SubmitWebViewFormWithId(kFormID); | 189 chrome_test_util::SubmitWebViewFormWithId(kFormID); |
| 191 | 190 |
| 192 // Wait until the page is half loaded. | 191 // Wait until the page is half loaded. |
| 193 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kPageText)] | 192 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kPageText)] |
| 194 assertWithMatcher:grey_notNil()]; | 193 assertWithMatcher:grey_notNil()]; |
| 195 | 194 |
| 196 // Verify progress view visible and halfway progress. | 195 // Verify progress view visible and halfway progress. |
| 197 [[EarlGrey selectElementWithMatcher:ProgressViewWithProgress(0.5)] | 196 [[EarlGrey selectElementWithMatcher:ProgressViewWithProgress(0.5)] |
| 198 assertWithMatcher:grey_sufficientlyVisible()]; | 197 assertWithMatcher:grey_sufficientlyVisible()]; |
| 199 | 198 |
| 200 // Verify toolbar visible. | 199 [ChromeEarlGreyUI waitForToolbarVisible:YES]; |
| 201 chrome_test_util::AssertToolbarVisible(); | |
| 202 } | 200 } |
| 203 | 201 |
| 204 // Tests that the progress indicator disappears after form has been submitted. | 202 // Tests that the progress indicator disappears after form has been submitted. |
| 205 - (void)testProgressIndicatorDisappearsAfterFormSubmit { | 203 - (void)testProgressIndicatorDisappearsAfterFormSubmit { |
| 206 if (IsIPadIdiom()) { | 204 if (IsIPadIdiom()) { |
| 207 EARL_GREY_TEST_SKIPPED(@"Skipped for iPad (no progress view in tablet)"); | 205 EARL_GREY_TEST_SKIPPED(@"Skipped for iPad (no progress view in tablet)"); |
| 208 } | 206 } |
| 209 | 207 |
| 210 const GURL formURL = web::test::HttpServer::MakeUrl(kFormURL); | 208 const GURL formURL = web::test::HttpServer::MakeUrl(kFormURL); |
| 211 const GURL simplePageURL = web::test::HttpServer::MakeUrl(kSimplePageURL); | 209 const GURL simplePageURL = web::test::HttpServer::MakeUrl(kSimplePageURL); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 assertWithMatcher:grey_notNil()]; | 250 assertWithMatcher:grey_notNil()]; |
| 253 | 251 |
| 254 chrome_test_util::SubmitWebViewFormWithId(kFormID); | 252 chrome_test_util::SubmitWebViewFormWithId(kFormID); |
| 255 | 253 |
| 256 // Verify progress view is not visible. | 254 // Verify progress view is not visible. |
| 257 [[EarlGrey selectElementWithMatcher:grey_kindOfClass([MDCProgressView class])] | 255 [[EarlGrey selectElementWithMatcher:grey_kindOfClass([MDCProgressView class])] |
| 258 assertWithMatcher:grey_notVisible()]; | 256 assertWithMatcher:grey_notVisible()]; |
| 259 } | 257 } |
| 260 | 258 |
| 261 @end | 259 @end |
| OLD | NEW |