| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <cmath> | 5 #include <cmath> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 EXPECT_EQ(2U, whitelist_manager_->url_prefixes().size()); | 199 EXPECT_EQ(2U, whitelist_manager_->url_prefixes().size()); |
| 200 } | 200 } |
| 201 | 201 |
| 202 TEST_F(WhitelistManagerTest, DownloadWhitelistRetry) { | 202 TEST_F(WhitelistManagerTest, DownloadWhitelistRetry) { |
| 203 CommandLine::ForCurrentProcess()->AppendSwitch( | 203 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 204 switches::kEnableExperimentalFormFilling); | 204 switches::kEnableExperimentalFormFilling); |
| 205 | 205 |
| 206 for (size_t i = 0; i < arraysize(kBackoffDelaysInMs); ++i) { | 206 for (size_t i = 0; i < arraysize(kBackoffDelaysInMs); ++i) { |
| 207 DownloadWhitelist(net::HTTP_INTERNAL_SERVER_ERROR, | 207 DownloadWhitelist(net::HTTP_INTERNAL_SERVER_ERROR, |
| 208 kDownloadWhitelistResponse); | 208 kDownloadWhitelistResponse); |
| 209 SCOPED_TRACE( | 209 SCOPED_TRACE(base::StringPrintf("Testing retry %" PRIuS |
| 210 base::StringPrintf("Testing retry %"PRIuS", expecting delay: %"PRId64, | 210 ", expecting delay: %" PRId64, |
| 211 i, kBackoffDelaysInMs[i])); | 211 i, |
| 212 kBackoffDelaysInMs[i])); |
| 212 EXPECT_EQ( | 213 EXPECT_EQ( |
| 213 kBackoffDelaysInMs[i], | 214 kBackoffDelaysInMs[i], |
| 214 whitelist_manager_->download_interval().InMillisecondsRoundedUp()); | 215 whitelist_manager_->download_interval().InMillisecondsRoundedUp()); |
| 215 } | 216 } |
| 216 } | 217 } |
| 217 | 218 |
| 218 TEST_F(WhitelistManagerTest, GetMatchedURLPrefix) { | 219 TEST_F(WhitelistManagerTest, GetMatchedURLPrefix) { |
| 219 CommandLine::ForCurrentProcess()->AppendSwitch( | 220 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 220 switches::kEnableExperimentalFormFilling); | 221 switches::kEnableExperimentalFormFilling); |
| 221 DownloadWhitelist(net::HTTP_OK, kDownloadWhitelistResponse); | 222 DownloadWhitelist(net::HTTP_OK, kDownloadWhitelistResponse); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 GURL("https://cart.merchant2.com/ShippingInfo?a=b&c=d"))); | 300 GURL("https://cart.merchant2.com/ShippingInfo?a=b&c=d"))); |
| 300 // Bypass other urls. | 301 // Bypass other urls. |
| 301 EXPECT_EQ(std::string("https://bypass.me/"), | 302 EXPECT_EQ(std::string("https://bypass.me/"), |
| 302 whitelist_manager_->GetMatchedURLPrefix( | 303 whitelist_manager_->GetMatchedURLPrefix( |
| 303 GURL("https://bypass.me/"))); | 304 GURL("https://bypass.me/"))); |
| 304 } | 305 } |
| 305 | 306 |
| 306 } // namespace autocheckout | 307 } // namespace autocheckout |
| 307 } // namespace autofill | 308 } // namespace autofill |
| 308 | 309 |
| OLD | NEW |