Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: components/component_updater/configurator_impl_unittest.cc

Issue 2169323003: Test current behavior of -component-updater=fast-update in ConfiguratorImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/component_updater/configurator_impl.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « components/component_updater/configurator_impl.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698