| 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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "content/public/common/browser_side_navigation_policy.h" | 13 #include "content/public/common/browser_side_navigation_policy.h" |
| 14 #include "content/public/test/content_browser_test.h" | 14 #include "content/public/test/content_browser_test.h" |
| 15 #include "content/public/test/content_browser_test_utils.h" | 15 #include "content/public/test/content_browser_test_utils.h" |
| 16 #include "content/shell/browser/shell.h" | 16 #include "content/shell/browser/shell.h" |
| 17 #include "net/test/embedded_test_server/embedded_test_server.h" | 17 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 18 #include "net/test/embedded_test_server/http_request.h" | 18 #include "net/test/embedded_test_server/http_request.h" |
| 19 #include "net/test/embedded_test_server/http_response.h" | 19 #include "net/test/embedded_test_server/http_response.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 using net::test_server::HttpRequest; | 27 using net::test_server::HttpRequest; |
| 28 using net::test_server::HttpResponse; | 28 using net::test_server::HttpResponse; |
| 29 | 29 |
| 30 const char kReloadTestPath[] = "/loader/reload.html"; | 30 const char kReloadTestPath[] = "/loader/reload_test.html"; |
| 31 const char kReloadFramePath[] = "/loader/simple_frame.html"; |
| 31 const char kReloadImagePath[] = "/loader/empty16x16.png"; | 32 const char kReloadImagePath[] = "/loader/empty16x16.png"; |
| 33 // The test page should request resources as the content structure is described |
| 34 // below. Reload and the same page navigation will affect only the top frame |
| 35 // resource, reload_test.html. But bypassing reload will affect all resources. |
| 36 // +- reload_test.html |
| 37 // +- empty16x16.png |
| 38 // +- simple_frame.html |
| 39 // +- empty16x16.png |
| 32 | 40 |
| 33 const char kNoCacheControl[] = ""; | 41 const char kNoCacheControl[] = ""; |
| 34 const char kMaxAgeCacheControl[] = "max-age=0"; | 42 const char kMaxAgeCacheControl[] = "max-age=0"; |
| 35 const char kNoCacheCacheControl[] = "no-cache"; | 43 const char kNoCacheCacheControl[] = "no-cache"; |
| 36 | 44 |
| 37 struct RequestLog { | 45 struct RequestLog { |
| 38 std::string relative_url; | 46 std::string relative_url; |
| 39 std::string cache_control; | 47 std::string cache_control; |
| 40 }; | 48 }; |
| 41 | 49 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 log.cache_control = cache_control == request.headers.end() | 81 log.cache_control = cache_control == request.headers.end() |
| 74 ? kNoCacheControl | 82 ? kNoCacheControl |
| 75 : cache_control->second; | 83 : cache_control->second; |
| 76 base::AutoLock lock(request_log_lock_); | 84 base::AutoLock lock(request_log_lock_); |
| 77 request_log_.push_back(log); | 85 request_log_.push_back(log); |
| 78 } | 86 } |
| 79 | 87 |
| 80 DISALLOW_COPY_AND_ASSIGN(ReloadCacheControlBrowserTest); | 88 DISALLOW_COPY_AND_ASSIGN(ReloadCacheControlBrowserTest); |
| 81 }; | 89 }; |
| 82 | 90 |
| 91 // Test if reload issues requests with proper cache control flags. |
| 83 IN_PROC_BROWSER_TEST_F(ReloadCacheControlBrowserTest, NormalReload) { | 92 IN_PROC_BROWSER_TEST_F(ReloadCacheControlBrowserTest, NormalReload) { |
| 84 GURL url(embedded_test_server()->GetURL(kReloadTestPath)); | 93 GURL url(embedded_test_server()->GetURL(kReloadTestPath)); |
| 85 | 94 |
| 86 EXPECT_TRUE(NavigateToURL(shell(), url)); | 95 EXPECT_TRUE(NavigateToURL(shell(), url)); |
| 87 ReloadBlockUntilNavigationsComplete(shell(), 1); | 96 ReloadBlockUntilNavigationsComplete(shell(), 1); |
| 88 | 97 |
| 89 { | 98 { |
| 90 base::AutoLock lock(request_log_lock_); | 99 base::AutoLock lock(request_log_lock_); |
| 91 ASSERT_EQ(4UL, request_log_.size()); | 100 ASSERT_EQ(8UL, request_log_.size()); |
| 92 EXPECT_EQ(kReloadTestPath, request_log_[0].relative_url); | 101 EXPECT_EQ(kReloadTestPath, request_log_[0].relative_url); |
| 93 EXPECT_EQ(kNoCacheControl, request_log_[0].cache_control); | 102 EXPECT_EQ(kNoCacheControl, request_log_[0].cache_control); |
| 94 EXPECT_EQ(kReloadImagePath, request_log_[1].relative_url); | 103 EXPECT_EQ(kReloadImagePath, request_log_[1].relative_url); |
| 95 EXPECT_EQ(kNoCacheControl, request_log_[1].cache_control); | 104 EXPECT_EQ(kNoCacheControl, request_log_[1].cache_control); |
| 96 | 105 EXPECT_EQ(kReloadFramePath, request_log_[2].relative_url); |
| 97 EXPECT_EQ(kReloadTestPath, request_log_[2].relative_url); | 106 EXPECT_EQ(kNoCacheControl, request_log_[2].cache_control); |
| 98 EXPECT_EQ(kMaxAgeCacheControl, request_log_[2].cache_control); | |
| 99 EXPECT_EQ(kReloadImagePath, request_log_[3].relative_url); | 107 EXPECT_EQ(kReloadImagePath, request_log_[3].relative_url); |
| 100 EXPECT_EQ(kNoCacheControl, request_log_[3].cache_control); | 108 EXPECT_EQ(kNoCacheControl, request_log_[3].cache_control); |
| 109 |
| 110 // Only the top main resource should be requested with kMaxAgeCacheControl. |
| 111 EXPECT_EQ(kReloadTestPath, request_log_[4].relative_url); |
| 112 EXPECT_EQ(kMaxAgeCacheControl, request_log_[4].cache_control); |
| 113 EXPECT_EQ(kReloadImagePath, request_log_[5].relative_url); |
| 114 EXPECT_EQ(kNoCacheControl, request_log_[5].cache_control); |
| 115 EXPECT_EQ(kReloadFramePath, request_log_[6].relative_url); |
| 116 EXPECT_EQ(kNoCacheControl, request_log_[6].cache_control); |
| 117 EXPECT_EQ(kReloadImagePath, request_log_[7].relative_url); |
| 118 EXPECT_EQ(kNoCacheControl, request_log_[7].cache_control); |
| 101 } | 119 } |
| 102 | 120 |
| 103 shell()->ShowDevTools(); | 121 shell()->ShowDevTools(); |
| 104 ReloadBlockUntilNavigationsComplete(shell(), 1); | 122 ReloadBlockUntilNavigationsComplete(shell(), 1); |
| 105 | 123 |
| 106 { | 124 { |
| 107 base::AutoLock lock(request_log_lock_); | 125 base::AutoLock lock(request_log_lock_); |
| 108 ASSERT_EQ(6UL, request_log_.size()); | 126 ASSERT_EQ(12UL, request_log_.size()); |
| 109 EXPECT_EQ(kReloadTestPath, request_log_[4].relative_url); | 127 |
| 110 EXPECT_EQ(kMaxAgeCacheControl, request_log_[4].cache_control); | 128 // Only the top main resource should be requested with kMaxAgeCacheControl. |
| 111 EXPECT_EQ(kReloadImagePath, request_log_[5].relative_url); | 129 EXPECT_EQ(kReloadTestPath, request_log_[8].relative_url); |
| 112 EXPECT_EQ(kNoCacheControl, request_log_[5].cache_control); | 130 EXPECT_EQ(kMaxAgeCacheControl, request_log_[8].cache_control); |
| 131 EXPECT_EQ(kReloadImagePath, request_log_[9].relative_url); |
| 132 EXPECT_EQ(kNoCacheControl, request_log_[9].cache_control); |
| 133 EXPECT_EQ(kReloadFramePath, request_log_[10].relative_url); |
| 134 EXPECT_EQ(kNoCacheControl, request_log_[10].cache_control); |
| 135 EXPECT_EQ(kReloadImagePath, request_log_[11].relative_url); |
| 136 EXPECT_EQ(kNoCacheControl, request_log_[11].cache_control); |
| 113 } | 137 } |
| 114 | 138 |
| 115 shell()->CloseDevTools(); | 139 shell()->CloseDevTools(); |
| 116 ReloadBlockUntilNavigationsComplete(shell(), 1); | 140 ReloadBlockUntilNavigationsComplete(shell(), 1); |
| 117 | 141 |
| 118 { | 142 { |
| 119 base::AutoLock lock(request_log_lock_); | 143 base::AutoLock lock(request_log_lock_); |
| 120 ASSERT_EQ(8UL, request_log_.size()); | 144 ASSERT_EQ(16UL, request_log_.size()); |
| 121 EXPECT_EQ(kReloadTestPath, request_log_[6].relative_url); | 145 |
| 122 EXPECT_EQ(kMaxAgeCacheControl, request_log_[6].cache_control); | 146 // Only the top main resource should be requested with kMaxAgeCacheControl. |
| 123 EXPECT_EQ(kReloadImagePath, request_log_[7].relative_url); | 147 EXPECT_EQ(kReloadTestPath, request_log_[12].relative_url); |
| 124 EXPECT_EQ(kNoCacheControl, request_log_[7].cache_control); | 148 EXPECT_EQ(kMaxAgeCacheControl, request_log_[12].cache_control); |
| 149 EXPECT_EQ(kReloadImagePath, request_log_[13].relative_url); |
| 150 EXPECT_EQ(kNoCacheControl, request_log_[13].cache_control); |
| 151 EXPECT_EQ(kReloadFramePath, request_log_[14].relative_url); |
| 152 EXPECT_EQ(kNoCacheControl, request_log_[14].cache_control); |
| 153 EXPECT_EQ(kReloadImagePath, request_log_[15].relative_url); |
| 154 EXPECT_EQ(kNoCacheControl, request_log_[15].cache_control); |
| 125 } | 155 } |
| 126 } | 156 } |
| 127 | 157 |
| 158 // Test if bypassing reload issues requests with proper cache control flags. |
| 128 IN_PROC_BROWSER_TEST_F(ReloadCacheControlBrowserTest, BypassingReload) { | 159 IN_PROC_BROWSER_TEST_F(ReloadCacheControlBrowserTest, BypassingReload) { |
| 129 GURL url(embedded_test_server()->GetURL(kReloadTestPath)); | 160 GURL url(embedded_test_server()->GetURL(kReloadTestPath)); |
| 130 | 161 |
| 131 EXPECT_TRUE(NavigateToURL(shell(), url)); | 162 EXPECT_TRUE(NavigateToURL(shell(), url)); |
| 132 ReloadBypassingCacheBlockUntilNavigationsComplete(shell(), 1); | 163 ReloadBypassingCacheBlockUntilNavigationsComplete(shell(), 1); |
| 133 | 164 |
| 134 { | 165 { |
| 135 base::AutoLock lock(request_log_lock_); | 166 base::AutoLock lock(request_log_lock_); |
| 136 ASSERT_EQ(4UL, request_log_.size()); | 167 ASSERT_EQ(8UL, request_log_.size()); |
| 137 EXPECT_EQ(kReloadTestPath, request_log_[0].relative_url); | 168 EXPECT_EQ(kReloadTestPath, request_log_[0].relative_url); |
| 138 EXPECT_EQ(kNoCacheControl, request_log_[0].cache_control); | 169 EXPECT_EQ(kNoCacheControl, request_log_[0].cache_control); |
| 139 EXPECT_EQ(kReloadImagePath, request_log_[1].relative_url); | 170 EXPECT_EQ(kReloadImagePath, request_log_[1].relative_url); |
| 140 EXPECT_EQ(kNoCacheControl, request_log_[1].cache_control); | 171 EXPECT_EQ(kNoCacheControl, request_log_[1].cache_control); |
| 172 EXPECT_EQ(kReloadFramePath, request_log_[2].relative_url); |
| 173 EXPECT_EQ(kNoCacheControl, request_log_[2].cache_control); |
| 174 EXPECT_EQ(kReloadImagePath, request_log_[3].relative_url); |
| 175 EXPECT_EQ(kNoCacheControl, request_log_[3].cache_control); |
| 141 | 176 |
| 142 EXPECT_EQ(kReloadTestPath, request_log_[2].relative_url); | 177 // Only the top main resource should be requested with kNoCacheCacheControl. |
| 143 EXPECT_EQ(kNoCacheCacheControl, request_log_[2].cache_control); | 178 EXPECT_EQ(kReloadTestPath, request_log_[4].relative_url); |
| 144 EXPECT_EQ(kReloadImagePath, request_log_[3].relative_url); | 179 EXPECT_EQ(kNoCacheCacheControl, request_log_[4].cache_control); |
| 145 EXPECT_EQ(kNoCacheCacheControl, request_log_[3].cache_control); | 180 EXPECT_EQ(kReloadImagePath, request_log_[5].relative_url); |
| 181 EXPECT_EQ(kNoCacheCacheControl, request_log_[5].cache_control); |
| 182 EXPECT_EQ(kReloadFramePath, request_log_[6].relative_url); |
| 183 EXPECT_EQ(kNoCacheCacheControl, request_log_[6].cache_control); |
| 184 EXPECT_EQ(kReloadImagePath, request_log_[7].relative_url); |
| 185 EXPECT_EQ(kNoCacheCacheControl, request_log_[7].cache_control); |
| 146 } | 186 } |
| 147 | 187 |
| 148 shell()->ShowDevTools(); | 188 shell()->ShowDevTools(); |
| 149 ReloadBypassingCacheBlockUntilNavigationsComplete(shell(), 1); | 189 ReloadBypassingCacheBlockUntilNavigationsComplete(shell(), 1); |
| 150 | 190 |
| 151 { | 191 { |
| 152 base::AutoLock lock(request_log_lock_); | 192 base::AutoLock lock(request_log_lock_); |
| 153 ASSERT_EQ(6UL, request_log_.size()); | 193 ASSERT_EQ(12UL, request_log_.size()); |
| 154 EXPECT_EQ(kReloadTestPath, request_log_[4].relative_url); | 194 |
| 155 EXPECT_EQ(kNoCacheCacheControl, request_log_[4].cache_control); | 195 // All resources should be requested with kNoCacheCacheControl. |
| 156 EXPECT_EQ(kReloadImagePath, request_log_[5].relative_url); | 196 EXPECT_EQ(kReloadTestPath, request_log_[8].relative_url); |
| 157 EXPECT_EQ(kNoCacheCacheControl, request_log_[5].cache_control); | 197 EXPECT_EQ(kNoCacheCacheControl, request_log_[8].cache_control); |
| 198 EXPECT_EQ(kReloadImagePath, request_log_[9].relative_url); |
| 199 EXPECT_EQ(kNoCacheCacheControl, request_log_[9].cache_control); |
| 200 EXPECT_EQ(kReloadFramePath, request_log_[10].relative_url); |
| 201 EXPECT_EQ(kNoCacheCacheControl, request_log_[10].cache_control); |
| 202 EXPECT_EQ(kReloadImagePath, request_log_[11].relative_url); |
| 203 EXPECT_EQ(kNoCacheCacheControl, request_log_[11].cache_control); |
| 158 } | 204 } |
| 159 | 205 |
| 160 shell()->CloseDevTools(); | 206 shell()->CloseDevTools(); |
| 161 ReloadBypassingCacheBlockUntilNavigationsComplete(shell(), 1); | 207 ReloadBypassingCacheBlockUntilNavigationsComplete(shell(), 1); |
| 162 | 208 |
| 163 { | 209 { |
| 164 base::AutoLock lock(request_log_lock_); | 210 base::AutoLock lock(request_log_lock_); |
| 165 ASSERT_EQ(8UL, request_log_.size()); | 211 ASSERT_EQ(16UL, request_log_.size()); |
| 166 EXPECT_EQ(kReloadTestPath, request_log_[6].relative_url); | 212 |
| 167 EXPECT_EQ(kNoCacheCacheControl, request_log_[6].cache_control); | 213 // All resources should be requested with kNoCacheCacheControl. |
| 168 EXPECT_EQ(kReloadImagePath, request_log_[7].relative_url); | 214 EXPECT_EQ(kReloadTestPath, request_log_[12].relative_url); |
| 169 EXPECT_EQ(kNoCacheCacheControl, request_log_[7].cache_control); | 215 EXPECT_EQ(kNoCacheCacheControl, request_log_[12].cache_control); |
| 216 EXPECT_EQ(kReloadImagePath, request_log_[13].relative_url); |
| 217 EXPECT_EQ(kNoCacheCacheControl, request_log_[13].cache_control); |
| 218 EXPECT_EQ(kReloadFramePath, request_log_[14].relative_url); |
| 219 EXPECT_EQ(kNoCacheCacheControl, request_log_[14].cache_control); |
| 220 EXPECT_EQ(kReloadImagePath, request_log_[15].relative_url); |
| 221 EXPECT_EQ(kNoCacheCacheControl, request_log_[15].cache_control); |
| 170 } | 222 } |
| 171 } | 223 } |
| 172 | 224 |
| 225 // Test if the same page navigation issues requests with proper cache control |
| 226 // flags. |
| 173 IN_PROC_BROWSER_TEST_F(ReloadCacheControlBrowserTest, NavigateToSame) { | 227 IN_PROC_BROWSER_TEST_F(ReloadCacheControlBrowserTest, NavigateToSame) { |
| 174 GURL url(embedded_test_server()->GetURL(kReloadTestPath)); | 228 GURL url(embedded_test_server()->GetURL(kReloadTestPath)); |
| 175 | 229 |
| 176 EXPECT_TRUE(NavigateToURL(shell(), url)); | 230 EXPECT_TRUE(NavigateToURL(shell(), url)); |
| 177 EXPECT_TRUE(NavigateToURL(shell(), url)); | 231 EXPECT_TRUE(NavigateToURL(shell(), url)); |
| 178 | 232 |
| 179 // The first navigation is just a normal load. | 233 // The first navigation is just a normal load. |
| 180 { | 234 { |
| 181 base::AutoLock lock(request_log_lock_); | 235 base::AutoLock lock(request_log_lock_); |
| 182 ASSERT_EQ(4UL, request_log_.size()); | 236 ASSERT_EQ(8UL, request_log_.size()); |
| 183 EXPECT_EQ(kReloadTestPath, request_log_[0].relative_url); | 237 EXPECT_EQ(kReloadTestPath, request_log_[0].relative_url); |
| 184 EXPECT_EQ(kNoCacheControl, request_log_[0].cache_control); | 238 EXPECT_EQ(kNoCacheControl, request_log_[0].cache_control); |
| 185 EXPECT_EQ(kReloadImagePath, request_log_[1].relative_url); | 239 EXPECT_EQ(kReloadImagePath, request_log_[1].relative_url); |
| 186 EXPECT_EQ(kNoCacheControl, request_log_[1].cache_control); | 240 EXPECT_EQ(kNoCacheControl, request_log_[1].cache_control); |
| 241 EXPECT_EQ(kReloadFramePath, request_log_[2].relative_url); |
| 242 EXPECT_EQ(kNoCacheControl, request_log_[3].cache_control); |
| 243 EXPECT_EQ(kReloadImagePath, request_log_[3].relative_url); |
| 244 EXPECT_EQ(kNoCacheControl, request_log_[3].cache_control); |
| 187 } | 245 } |
| 188 | 246 |
| 189 // TODO(crbug.com/671545): This test does not work correctly if browser-side | 247 // TODO(crbug.com/671545): This test does not work correctly if browser-side |
| 190 // navigation is enabled. | 248 // navigation is enabled. |
| 191 if (IsBrowserSideNavigationEnabled()) | 249 if (IsBrowserSideNavigationEnabled()) |
| 192 return; | 250 return; |
| 193 | 251 |
| 194 // The second navigation is the same page navigation. This should be handled | 252 // The second navigation is the same page navigation. This should be handled |
| 195 // as a reload, revalidating the main resource, but following cache protocols | 253 // as a reload, revalidating the main resource, but following cache protocols |
| 196 // for others. | 254 // for others. |
| 197 { | 255 { |
| 198 base::AutoLock lock(request_log_lock_); | 256 base::AutoLock lock(request_log_lock_); |
| 199 EXPECT_EQ(kReloadTestPath, request_log_[2].relative_url); | 257 |
| 200 EXPECT_EQ(kMaxAgeCacheControl, request_log_[2].cache_control); | 258 // Only the top main resource should be requested with kMaxAgeCacheControl. |
| 201 EXPECT_EQ(kReloadImagePath, request_log_[3].relative_url); | 259 EXPECT_EQ(kReloadTestPath, request_log_[4].relative_url); |
| 202 EXPECT_EQ(kNoCacheControl, request_log_[3].cache_control); | 260 EXPECT_EQ(kMaxAgeCacheControl, request_log_[4].cache_control); |
| 261 EXPECT_EQ(kReloadImagePath, request_log_[5].relative_url); |
| 262 EXPECT_EQ(kNoCacheControl, request_log_[5].cache_control); |
| 263 EXPECT_EQ(kReloadFramePath, request_log_[6].relative_url); |
| 264 EXPECT_EQ(kNoCacheControl, request_log_[6].cache_control); |
| 265 EXPECT_EQ(kReloadImagePath, request_log_[7].relative_url); |
| 266 EXPECT_EQ(kNoCacheControl, request_log_[7].cache_control); |
| 203 } | 267 } |
| 204 | 268 |
| 205 shell()->ShowDevTools(); | 269 shell()->ShowDevTools(); |
| 206 EXPECT_TRUE(NavigateToURL(shell(), url)); | 270 EXPECT_TRUE(NavigateToURL(shell(), url)); |
| 207 | 271 |
| 208 { | 272 { |
| 209 base::AutoLock lock(request_log_lock_); | 273 base::AutoLock lock(request_log_lock_); |
| 210 ASSERT_EQ(6UL, request_log_.size()); | 274 ASSERT_EQ(12UL, request_log_.size()); |
| 211 EXPECT_EQ(kReloadTestPath, request_log_[4].relative_url); | 275 |
| 212 EXPECT_EQ(kMaxAgeCacheControl, request_log_[4].cache_control); | 276 // Only the top main resource should be requested with kMaxAgeCacheControl. |
| 213 EXPECT_EQ(kReloadImagePath, request_log_[5].relative_url); | 277 EXPECT_EQ(kReloadTestPath, request_log_[8].relative_url); |
| 214 EXPECT_EQ(kNoCacheControl, request_log_[5].cache_control); | 278 EXPECT_EQ(kMaxAgeCacheControl, request_log_[8].cache_control); |
| 279 EXPECT_EQ(kReloadImagePath, request_log_[9].relative_url); |
| 280 EXPECT_EQ(kNoCacheControl, request_log_[9].cache_control); |
| 281 EXPECT_EQ(kReloadFramePath, request_log_[10].relative_url); |
| 282 EXPECT_EQ(kNoCacheControl, request_log_[10].cache_control); |
| 283 EXPECT_EQ(kReloadImagePath, request_log_[11].relative_url); |
| 284 EXPECT_EQ(kNoCacheControl, request_log_[11].cache_control); |
| 215 } | 285 } |
| 216 | 286 |
| 217 shell()->CloseDevTools(); | 287 shell()->CloseDevTools(); |
| 218 EXPECT_TRUE(NavigateToURL(shell(), url)); | 288 EXPECT_TRUE(NavigateToURL(shell(), url)); |
| 219 | 289 |
| 220 { | 290 { |
| 221 base::AutoLock lock(request_log_lock_); | 291 base::AutoLock lock(request_log_lock_); |
| 222 ASSERT_EQ(8UL, request_log_.size()); | 292 ASSERT_EQ(16UL, request_log_.size()); |
| 223 EXPECT_EQ(kReloadTestPath, request_log_[6].relative_url); | 293 |
| 224 EXPECT_EQ(kMaxAgeCacheControl, request_log_[6].cache_control); | 294 // Only the top main resource should be requested with kMaxAgeCacheControl. |
| 225 EXPECT_EQ(kReloadImagePath, request_log_[7].relative_url); | 295 EXPECT_EQ(kReloadTestPath, request_log_[12].relative_url); |
| 226 EXPECT_EQ(kNoCacheControl, request_log_[7].cache_control); | 296 EXPECT_EQ(kMaxAgeCacheControl, request_log_[12].cache_control); |
| 297 EXPECT_EQ(kReloadImagePath, request_log_[13].relative_url); |
| 298 EXPECT_EQ(kNoCacheControl, request_log_[13].cache_control); |
| 299 EXPECT_EQ(kReloadFramePath, request_log_[14].relative_url); |
| 300 EXPECT_EQ(kNoCacheControl, request_log_[14].cache_control); |
| 301 EXPECT_EQ(kReloadImagePath, request_log_[15].relative_url); |
| 302 EXPECT_EQ(kNoCacheControl, request_log_[15].cache_control); |
| 227 } | 303 } |
| 228 } | 304 } |
| 229 | 305 |
| 230 } // namespace | 306 } // namespace |
| 231 | 307 |
| 232 } // namespace content | 308 } // namespace content |
| OLD | NEW |