| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include <memory> |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "base/macros.h" |
| 9 #include "components/component_updater/configurator_impl.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 |
| 12 namespace component_updater { |
| 13 |
| 14 namespace { |
| 15 |
| 16 const int kDelayOneMinute = 60; |
| 17 const int kDelayOneHour = kDelayOneMinute * 60; |
| 18 |
| 19 } // namespace |
| 20 |
| 21 using base::CommandLine; |
| 22 |
| 23 class ComponentUpdaterConfiguratorImplTest : public testing::Test { |
| 24 public: |
| 25 ComponentUpdaterConfiguratorImplTest() {} |
| 26 ~ComponentUpdaterConfiguratorImplTest() override {} |
| 27 |
| 28 private: |
| 29 DISALLOW_COPY_AND_ASSIGN(ComponentUpdaterConfiguratorImplTest); |
| 30 }; |
| 31 |
| 32 TEST_F(ComponentUpdaterConfiguratorImplTest, FastUpdate) { |
| 33 // Test the default timing values when no command line argument is present. |
| 34 base::CommandLine cmdline(base::CommandLine::NO_PROGRAM); |
| 35 std::unique_ptr<ConfiguratorImpl> config( |
| 36 new ConfiguratorImpl(&cmdline, nullptr, false)); |
| 37 CHECK_EQ(6 * kDelayOneMinute, config->InitialDelay()); |
| 38 CHECK_EQ(6 * kDelayOneHour, config->NextCheckDelay()); |
| 39 CHECK_EQ(1, config->StepDelay()); |
| 40 CHECK_EQ(30 * kDelayOneMinute, config->OnDemandDelay()); |
| 41 CHECK_EQ(15 * kDelayOneMinute, config->UpdateDelay()); |
| 42 |
| 43 // Test the fast-update timings. |
| 44 cmdline.AppendSwitchASCII("--component-updater", "fast-update"); |
| 45 config.reset(new ConfiguratorImpl(&cmdline, nullptr, false)); |
| 46 CHECK_EQ(10, config->InitialDelay()); |
| 47 CHECK_EQ(kDelayOneMinute, config->NextCheckDelay()); |
| 48 CHECK_EQ(1, config->StepDelay()); |
| 49 CHECK_EQ(2, config->OnDemandDelay()); |
| 50 CHECK_EQ(10, config->UpdateDelay()); |
| 51 } |
| 52 |
| 53 } // namespace component_updater |
| OLD | NEW |