| Index: components/component_updater/component_updater_service_unittest.cc
|
| diff --git a/components/component_updater/component_updater_service_unittest.cc b/components/component_updater/component_updater_service_unittest.cc
|
| index 15b62bb853b087008a9839e768f104ac969ce3d9..d0680d529d37330049ddaf4e9d7835024c507cbc 100644
|
| --- a/components/component_updater/component_updater_service_unittest.cc
|
| +++ b/components/component_updater/component_updater_service_unittest.cc
|
| @@ -15,6 +15,7 @@
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/run_loop.h"
|
| +#include "base/test/histogram_tester.h"
|
| #include "base/test/sequenced_worker_pool_owner.h"
|
| #include "base/thread_task_runner_handle.h"
|
| #include "base/values.h"
|
| @@ -215,6 +216,7 @@ TEST_F(ComponentUpdaterTest, RegisterComponent) {
|
| void OnUpdate(const std::vector<std::string>& ids,
|
| const UpdateClient::CrxDataCallback& crx_data_callback,
|
| const UpdateClient::CompletionCallback& completion_callback) {
|
| + completion_callback.Run(0);
|
| static int cnt = 0;
|
| ++cnt;
|
| if (cnt >= max_cnt_)
|
| @@ -226,6 +228,8 @@ TEST_F(ComponentUpdaterTest, RegisterComponent) {
|
| base::Closure quit_closure_;
|
| };
|
|
|
| + base::HistogramTester histogram_tester;
|
| +
|
| scoped_refptr<MockInstaller> installer(new MockInstaller());
|
| EXPECT_CALL(*installer, Uninstall()).WillOnce(Return(true));
|
|
|
| @@ -260,8 +264,11 @@ TEST_F(ComponentUpdaterTest, RegisterComponent) {
|
| EXPECT_TRUE(component_updater().RegisterComponent(crx_component2));
|
|
|
| RunThreads();
|
| -
|
| EXPECT_TRUE(component_updater().UnregisterComponent(id1));
|
| +
|
| + histogram_tester.ExpectUniqueSample("ComponentUpdater.Update.Count", 1, 2);
|
| + histogram_tester.ExpectUniqueSample("ComponentUpdater.Update.Result", 0, 2);
|
| + histogram_tester.ExpectTotalCount("ComponentUpdater.UpdateCompleteTime", 2);
|
| }
|
|
|
| // Tests that on-demand updates invoke UpdateClient::Install.
|
| @@ -275,6 +282,7 @@ TEST_F(ComponentUpdaterTest, OnDemandUpdate) {
|
| const std::string& ids,
|
| const UpdateClient::CrxDataCallback& crx_data_callback,
|
| const UpdateClient::CompletionCallback& completion_callback) {
|
| + completion_callback.Run(0);
|
| static int cnt = 0;
|
| ++cnt;
|
| if (cnt >= max_cnt_)
|
| @@ -286,6 +294,8 @@ TEST_F(ComponentUpdaterTest, OnDemandUpdate) {
|
| base::Closure quit_closure_;
|
| };
|
|
|
| + base::HistogramTester histogram_tester;
|
| +
|
| auto config = configurator();
|
| config->SetInitialDelay(3600);
|
|
|
| @@ -312,6 +322,10 @@ TEST_F(ComponentUpdaterTest, OnDemandUpdate) {
|
| EXPECT_TRUE(OnDemandTester::OnDemand(&cus, id));
|
|
|
| RunThreads();
|
| +
|
| + histogram_tester.ExpectUniqueSample("ComponentUpdater.Install.Count", 1, 1);
|
| + histogram_tester.ExpectUniqueSample("ComponentUpdater.Update.Result", 0, 1);
|
| + histogram_tester.ExpectTotalCount("ComponentUpdater.UpdateCompleteTime", 1);
|
| }
|
|
|
| // Tests that throttling an update invokes UpdateClient::Install.
|
| @@ -325,6 +339,7 @@ TEST_F(ComponentUpdaterTest, MaybeThrottle) {
|
| const std::string& ids,
|
| const UpdateClient::CrxDataCallback& crx_data_callback,
|
| const UpdateClient::CompletionCallback& completion_callback) {
|
| + completion_callback.Run(0);
|
| static int cnt = 0;
|
| ++cnt;
|
| if (cnt >= max_cnt_)
|
| @@ -336,6 +351,8 @@ TEST_F(ComponentUpdaterTest, MaybeThrottle) {
|
| base::Closure quit_closure_;
|
| };
|
|
|
| + base::HistogramTester histogram_tester;
|
| +
|
| auto config = configurator();
|
| config->SetInitialDelay(3600);
|
|
|
| @@ -359,6 +376,10 @@ TEST_F(ComponentUpdaterTest, MaybeThrottle) {
|
| base::Bind(&ComponentUpdaterTest::ReadyCallback));
|
|
|
| RunThreads();
|
| +
|
| + histogram_tester.ExpectUniqueSample("ComponentUpdater.Install.Count", 1, 1);
|
| + histogram_tester.ExpectUniqueSample("ComponentUpdater.Update.Result", 0, 1);
|
| + histogram_tester.ExpectTotalCount("ComponentUpdater.UpdateCompleteTime", 1);
|
| }
|
|
|
| } // namespace component_updater
|
|
|