Chromium Code Reviews| 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 #include <memory> | 5 #include <memory> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 EXPECT_EQ(kNoCacheControl, request_log_[13].cache_control); | 150 EXPECT_EQ(kNoCacheControl, request_log_[13].cache_control); |
| 151 EXPECT_EQ(kReloadFramePath, request_log_[14].relative_url); | 151 EXPECT_EQ(kReloadFramePath, request_log_[14].relative_url); |
| 152 EXPECT_EQ(kNoCacheControl, request_log_[14].cache_control); | 152 EXPECT_EQ(kNoCacheControl, request_log_[14].cache_control); |
| 153 EXPECT_EQ(kReloadImagePath, request_log_[15].relative_url); | 153 EXPECT_EQ(kReloadImagePath, request_log_[15].relative_url); |
| 154 EXPECT_EQ(kNoCacheControl, request_log_[15].cache_control); | 154 EXPECT_EQ(kNoCacheControl, request_log_[15].cache_control); |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 // Test if bypassing reload issues requests with proper cache control flags. | 158 // Test if bypassing reload issues requests with proper cache control flags. |
| 159 IN_PROC_BROWSER_TEST_F(ReloadCacheControlBrowserTest, BypassingReload) { | 159 IN_PROC_BROWSER_TEST_F(ReloadCacheControlBrowserTest, BypassingReload) { |
| 160 // TODO(crbug.com/671545): This test gets to be unstable if browser-side | |
| 161 // navigation is enabled. This is because we can not ensure which of frame and | |
| 162 // image requests hits the network first. | |
| 163 if (IsBrowserSideNavigationEnabled()) | |
| 164 return; | |
| 165 | 160 |
| 166 GURL url(embedded_test_server()->GetURL(kReloadTestPath)); | 161 GURL url(embedded_test_server()->GetURL(kReloadTestPath)); |
| 167 | 162 |
| 168 EXPECT_TRUE(NavigateToURL(shell(), url)); | 163 NavigateToURLBlockUntilNavigationsComplete(shell(), url, 1); |
| 169 ReloadBypassingCacheBlockUntilNavigationsComplete(shell(), 1); | |
| 170 | |
| 171 { | 164 { |
| 172 base::AutoLock lock(request_log_lock_); | 165 base::AutoLock lock(request_log_lock_); |
| 173 ASSERT_EQ(8UL, request_log_.size()); | 166 ASSERT_EQ(4UL, request_log_.size()); |
| 167 | |
| 174 EXPECT_EQ(kReloadTestPath, request_log_[0].relative_url); | 168 EXPECT_EQ(kReloadTestPath, request_log_[0].relative_url); |
| 175 EXPECT_EQ(kNoCacheControl, request_log_[0].cache_control); | 169 EXPECT_EQ(kNoCacheControl, request_log_[0].cache_control); |
| 176 EXPECT_EQ(kReloadImagePath, request_log_[1].relative_url); | 170 EXPECT_EQ(kReloadImagePath, request_log_[1].relative_url); |
| 177 EXPECT_EQ(kNoCacheControl, request_log_[1].cache_control); | 171 EXPECT_EQ(kNoCacheControl, request_log_[1].cache_control); |
| 178 EXPECT_EQ(kReloadFramePath, request_log_[2].relative_url); | 172 EXPECT_EQ(kReloadFramePath, request_log_[2].relative_url); |
| 179 EXPECT_EQ(kNoCacheControl, request_log_[2].cache_control); | 173 EXPECT_EQ(kNoCacheControl, request_log_[2].cache_control); |
| 180 EXPECT_EQ(kReloadImagePath, request_log_[3].relative_url); | 174 EXPECT_EQ(kReloadImagePath, request_log_[3].relative_url); |
| 181 EXPECT_EQ(kNoCacheControl, request_log_[3].cache_control); | 175 EXPECT_EQ(kNoCacheControl, request_log_[3].cache_control); |
| 176 } | |
| 177 | |
| 178 ReloadBypassingCacheBlockUntilNavigationsComplete(shell(), 1); | |
| 179 { | |
| 180 base::AutoLock lock(request_log_lock_); | |
| 181 ASSERT_EQ(8UL, request_log_.size()); | |
|
arthursonzogni
2017/05/05 16:11:52
I broke it into two steps: initial load and reload
| |
| 182 | 182 |
| 183 // Only the top main resource should be requested with kNoCacheCacheControl. | 183 // Only the top main resource should be requested with kNoCacheCacheControl. |
| 184 EXPECT_EQ(kReloadTestPath, request_log_[4].relative_url); | 184 EXPECT_EQ(kReloadTestPath, request_log_[4].relative_url); |
| 185 EXPECT_EQ(kNoCacheCacheControl, request_log_[4].cache_control); | 185 EXPECT_EQ(kNoCacheCacheControl, request_log_[4].cache_control); |
| 186 EXPECT_EQ(kReloadImagePath, request_log_[5].relative_url); | 186 EXPECT_EQ(kReloadImagePath, request_log_[5].relative_url); |
| 187 EXPECT_EQ(kNoCacheCacheControl, request_log_[5].cache_control); | 187 EXPECT_EQ(kNoCacheCacheControl, request_log_[5].cache_control); |
| 188 EXPECT_EQ(kReloadFramePath, request_log_[6].relative_url); | 188 EXPECT_EQ(kReloadFramePath, request_log_[6].relative_url); |
| 189 EXPECT_EQ(kNoCacheCacheControl, request_log_[6].cache_control); | 189 EXPECT_EQ(kNoCacheCacheControl, request_log_[6].cache_control); |
| 190 EXPECT_EQ(kReloadImagePath, request_log_[7].relative_url); | 190 EXPECT_EQ(kReloadImagePath, request_log_[7].relative_url); |
| 191 EXPECT_EQ(kNoCacheCacheControl, request_log_[7].cache_control); | 191 EXPECT_EQ(kNoCacheCacheControl, request_log_[7].cache_control); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 EXPECT_EQ(kReloadFramePath, request_log_[14].relative_url); | 300 EXPECT_EQ(kReloadFramePath, request_log_[14].relative_url); |
| 301 EXPECT_EQ(kNoCacheControl, request_log_[14].cache_control); | 301 EXPECT_EQ(kNoCacheControl, request_log_[14].cache_control); |
| 302 EXPECT_EQ(kReloadImagePath, request_log_[15].relative_url); | 302 EXPECT_EQ(kReloadImagePath, request_log_[15].relative_url); |
| 303 EXPECT_EQ(kNoCacheControl, request_log_[15].cache_control); | 303 EXPECT_EQ(kNoCacheControl, request_log_[15].cache_control); |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 | 306 |
| 307 } // namespace | 307 } // namespace |
| 308 | 308 |
| 309 } // namespace content | 309 } // namespace content |
| OLD | NEW |