| 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/command_line.h" | |
| 12 #include "base/macros.h" | 11 #include "base/macros.h" |
| 13 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 14 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/browser_side_navigation_policy.h" |
| 15 #include "content/public/test/content_browser_test.h" | 14 #include "content/public/test/content_browser_test.h" |
| 16 #include "content/public/test/content_browser_test_utils.h" | 15 #include "content/public/test/content_browser_test_utils.h" |
| 17 #include "content/shell/browser/shell.h" | 16 #include "content/shell/browser/shell.h" |
| 18 #include "net/test/embedded_test_server/embedded_test_server.h" | 17 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 19 #include "net/test/embedded_test_server/http_request.h" | 18 #include "net/test/embedded_test_server/http_request.h" |
| 20 #include "net/test/embedded_test_server/http_response.h" | 19 #include "net/test/embedded_test_server/http_response.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 22 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 23 | 22 |
| 24 namespace content { | 23 namespace content { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 base::AutoLock lock(request_log_lock_); | 181 base::AutoLock lock(request_log_lock_); |
| 183 ASSERT_EQ(4UL, request_log_.size()); | 182 ASSERT_EQ(4UL, request_log_.size()); |
| 184 EXPECT_EQ(kReloadTestPath, request_log_[0].relative_url); | 183 EXPECT_EQ(kReloadTestPath, request_log_[0].relative_url); |
| 185 EXPECT_EQ(kNoCacheControl, request_log_[0].cache_control); | 184 EXPECT_EQ(kNoCacheControl, request_log_[0].cache_control); |
| 186 EXPECT_EQ(kReloadImagePath, request_log_[1].relative_url); | 185 EXPECT_EQ(kReloadImagePath, request_log_[1].relative_url); |
| 187 EXPECT_EQ(kNoCacheControl, request_log_[1].cache_control); | 186 EXPECT_EQ(kNoCacheControl, request_log_[1].cache_control); |
| 188 } | 187 } |
| 189 | 188 |
| 190 // TODO(crbug.com/671545): This test does not work correctly if browser-side | 189 // TODO(crbug.com/671545): This test does not work correctly if browser-side |
| 191 // navigation is enabled. | 190 // navigation is enabled. |
| 192 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 191 if (IsBrowserSideNavigationEnabled()) |
| 193 switches::kEnableBrowserSideNavigation)) | |
| 194 return; | 192 return; |
| 195 | 193 |
| 196 // The second navigation is the same page navigation. This should be handled | 194 // The second navigation is the same page navigation. This should be handled |
| 197 // as a reload, revalidating the main resource, but following cache protocols | 195 // as a reload, revalidating the main resource, but following cache protocols |
| 198 // for others. | 196 // for others. |
| 199 { | 197 { |
| 200 base::AutoLock lock(request_log_lock_); | 198 base::AutoLock lock(request_log_lock_); |
| 201 EXPECT_EQ(kReloadTestPath, request_log_[2].relative_url); | 199 EXPECT_EQ(kReloadTestPath, request_log_[2].relative_url); |
| 202 EXPECT_EQ(kMaxAgeCacheControl, request_log_[2].cache_control); | 200 EXPECT_EQ(kMaxAgeCacheControl, request_log_[2].cache_control); |
| 203 EXPECT_EQ(kReloadImagePath, request_log_[3].relative_url); | 201 EXPECT_EQ(kReloadImagePath, request_log_[3].relative_url); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 225 EXPECT_EQ(kReloadTestPath, request_log_[6].relative_url); | 223 EXPECT_EQ(kReloadTestPath, request_log_[6].relative_url); |
| 226 EXPECT_EQ(kMaxAgeCacheControl, request_log_[6].cache_control); | 224 EXPECT_EQ(kMaxAgeCacheControl, request_log_[6].cache_control); |
| 227 EXPECT_EQ(kReloadImagePath, request_log_[7].relative_url); | 225 EXPECT_EQ(kReloadImagePath, request_log_[7].relative_url); |
| 228 EXPECT_EQ(kNoCacheControl, request_log_[7].cache_control); | 226 EXPECT_EQ(kNoCacheControl, request_log_[7].cache_control); |
| 229 } | 227 } |
| 230 } | 228 } |
| 231 | 229 |
| 232 } // namespace | 230 } // namespace |
| 233 | 231 |
| 234 } // namespace content | 232 } // namespace content |
| OLD | NEW |