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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 GenericChromeCommand* reloadCommand = | 163 GenericChromeCommand* reloadCommand = |
164 [[GenericChromeCommand alloc] initWithTag:IDC_RELOAD]; | 164 [[GenericChromeCommand alloc] initWithTag:IDC_RELOAD]; |
165 chrome_test_util::RunCommandWithActiveViewController(reloadCommand); | 165 chrome_test_util::RunCommandWithActiveViewController(reloadCommand); |
166 | 166 |
167 [ChromeEarlGrey waitForPageToFinishLoading]; | 167 [ChromeEarlGrey waitForPageToFinishLoading]; |
168 } | 168 } |
169 | 169 |
170 // Navigates back to the previous webpage. | 170 // Navigates back to the previous webpage. |
171 // TODO(crbug.com/638674): Evaluate if this can move to shared code. | 171 // TODO(crbug.com/638674): Evaluate if this can move to shared code. |
172 - (void)goBack { | 172 - (void)goBack { |
173 GenericChromeCommand* backCommand = | 173 [chrome_test_util::BrowserCommandDispatcherForMainBVC() goBack]; |
174 [[GenericChromeCommand alloc] initWithTag:IDC_BACK]; | |
175 chrome_test_util::RunCommandWithActiveViewController(backCommand); | |
176 | 174 |
177 [ChromeEarlGrey waitForPageToFinishLoading]; | 175 [ChromeEarlGrey waitForPageToFinishLoading]; |
178 } | 176 } |
179 | 177 |
180 // Tests caching behavior on navigate back and page reload. Navigate back should | 178 // Tests caching behavior on navigate back and page reload. Navigate back should |
181 // use the cached page. Page reload should use cache-control in the request | 179 // use the cached page. Page reload should use cache-control in the request |
182 // header and show updated page. | 180 // header and show updated page. |
183 - (void)testCachingBehaviorOnNavigateBackAndPageReload { | 181 - (void)testCachingBehaviorOnNavigateBackAndPageReload { |
184 web::test::SetUpHttpServer(base::MakeUnique<CacheTestResponseProvider>()); | 182 web::test::SetUpHttpServer(base::MakeUnique<CacheTestResponseProvider>()); |
185 | 183 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 [[EarlGrey | 257 [[EarlGrey |
260 selectElementWithMatcher:grey_accessibilityID(@"omnibox suggestion 1")] | 258 selectElementWithMatcher:grey_accessibilityID(@"omnibox suggestion 1")] |
261 performAction:grey_tap()]; | 259 performAction:grey_tap()]; |
262 | 260 |
263 // Verify title and hitCount. Cache should not be used. | 261 // Verify title and hitCount. Cache should not be used. |
264 [ChromeEarlGrey waitForWebViewContainingText:"First Page"]; | 262 [ChromeEarlGrey waitForWebViewContainingText:"First Page"]; |
265 [ChromeEarlGrey waitForWebViewContainingText:"serverHitCounter: 2"]; | 263 [ChromeEarlGrey waitForWebViewContainingText:"serverHitCounter: 2"]; |
266 } | 264 } |
267 | 265 |
268 @end | 266 @end |
OLD | NEW |