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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/component_updater/configurator_impl.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/component_updater/configurator_impl_unittest.cc
diff --git a/components/component_updater/configurator_impl_unittest.cc b/components/component_updater/configurator_impl_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cf4ddeda3288f0dc083b3469175bf2301e4305b6
--- /dev/null
+++ b/components/component_updater/configurator_impl_unittest.cc
@@ -0,0 +1,53 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <memory>
+
+#include "base/command_line.h"
+#include "base/macros.h"
+#include "components/component_updater/configurator_impl.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace component_updater {
+
+namespace {
+
+const int kDelayOneMinute = 60;
+const int kDelayOneHour = kDelayOneMinute * 60;
+
+} // namespace
+
+using base::CommandLine;
+
+class ComponentUpdaterConfiguratorImplTest : public testing::Test {
+ public:
+ ComponentUpdaterConfiguratorImplTest() {}
+ ~ComponentUpdaterConfiguratorImplTest() override {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ComponentUpdaterConfiguratorImplTest);
+};
+
+TEST_F(ComponentUpdaterConfiguratorImplTest, FastUpdate) {
+ // Test the default timing values when no command line argument is present.
+ base::CommandLine cmdline(base::CommandLine::NO_PROGRAM);
+ std::unique_ptr<ConfiguratorImpl> config(
+ new ConfiguratorImpl(&cmdline, nullptr, false));
+ CHECK_EQ(6 * kDelayOneMinute, config->InitialDelay());
+ CHECK_EQ(6 * kDelayOneHour, config->NextCheckDelay());
+ CHECK_EQ(1, config->StepDelay());
+ CHECK_EQ(30 * kDelayOneMinute, config->OnDemandDelay());
+ CHECK_EQ(15 * kDelayOneMinute, config->UpdateDelay());
+
+ // Test the fast-update timings.
+ cmdline.AppendSwitchASCII("--component-updater", "fast-update");
+ config.reset(new ConfiguratorImpl(&cmdline, nullptr, false));
+ CHECK_EQ(10, config->InitialDelay());
+ CHECK_EQ(kDelayOneMinute, config->NextCheckDelay());
+ CHECK_EQ(1, config->StepDelay());
+ CHECK_EQ(2, config->OnDemandDelay());
+ CHECK_EQ(10, config->UpdateDelay());
+}
+
+} // namespace component_updater
« 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