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/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "components/content_settings/core/browser/host_content_settings_map.h" | 9 #include "components/content_settings/core/browser/host_content_settings_map.h" |
10 #include "components/content_settings/core/common/content_settings.h" | 10 #include "components/content_settings/core/common/content_settings.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 // Tests the browser cache behavior when navigating to cached pages. | 154 // Tests the browser cache behavior when navigating to cached pages. |
155 @interface CacheTestCase : ChromeTestCase | 155 @interface CacheTestCase : ChromeTestCase |
156 @end | 156 @end |
157 | 157 |
158 @implementation CacheTestCase | 158 @implementation CacheTestCase |
159 | 159 |
160 // Reloads the web view and waits for the loading to complete. | 160 // Reloads the web view and waits for the loading to complete. |
161 // TODO(crbug.com/638674): Evaluate if this can move to shared code | 161 // TODO(crbug.com/638674): Evaluate if this can move to shared code |
162 - (void)reloadPage { | 162 - (void)reloadPage { |
163 GenericChromeCommand* reloadCommand = | 163 [chrome_test_util::BrowserCommandDispatcherForMainBVC() reload]; |
164 [[GenericChromeCommand alloc] initWithTag:IDC_RELOAD]; | |
165 chrome_test_util::RunCommandWithActiveViewController(reloadCommand); | |
166 | 164 |
167 [ChromeEarlGrey waitForPageToFinishLoading]; | 165 [ChromeEarlGrey waitForPageToFinishLoading]; |
168 } | 166 } |
169 | 167 |
170 // Navigates back to the previous webpage. | 168 // Navigates back to the previous webpage. |
171 // TODO(crbug.com/638674): Evaluate if this can move to shared code. | 169 // TODO(crbug.com/638674): Evaluate if this can move to shared code. |
172 - (void)goBack { | 170 - (void)goBack { |
173 [chrome_test_util::BrowserCommandDispatcherForMainBVC() goBack]; | 171 [chrome_test_util::BrowserCommandDispatcherForMainBVC() goBack]; |
174 | 172 |
175 [ChromeEarlGrey waitForPageToFinishLoading]; | 173 [ChromeEarlGrey waitForPageToFinishLoading]; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 [[EarlGrey | 255 [[EarlGrey |
258 selectElementWithMatcher:grey_accessibilityID(@"omnibox suggestion 1")] | 256 selectElementWithMatcher:grey_accessibilityID(@"omnibox suggestion 1")] |
259 performAction:grey_tap()]; | 257 performAction:grey_tap()]; |
260 | 258 |
261 // Verify title and hitCount. Cache should not be used. | 259 // Verify title and hitCount. Cache should not be used. |
262 [ChromeEarlGrey waitForWebViewContainingText:"First Page"]; | 260 [ChromeEarlGrey waitForWebViewContainingText:"First Page"]; |
263 [ChromeEarlGrey waitForWebViewContainingText:"serverHitCounter: 2"]; | 261 [ChromeEarlGrey waitForWebViewContainingText:"serverHitCounter: 2"]; |
264 } | 262 } |
265 | 263 |
266 @end | 264 @end |
OLD | NEW |