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

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

Issue 2479633003: Makes the component installers return a Result instead of a bool. (Closed)
Patch Set: rebase Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/component_updater/component_updater_service.h" 5 #include "components/component_updater/component_updater_service.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 12 matching lines...) Expand all
23 #include "base/values.h" 23 #include "base/values.h"
24 #include "components/component_updater/component_updater_service_internal.h" 24 #include "components/component_updater/component_updater_service_internal.h"
25 #include "components/update_client/test_configurator.h" 25 #include "components/update_client/test_configurator.h"
26 #include "components/update_client/test_installer.h" 26 #include "components/update_client/test_installer.h"
27 #include "components/update_client/update_client.h" 27 #include "components/update_client/update_client.h"
28 #include "components/update_client/update_client_errors.h" 28 #include "components/update_client/update_client_errors.h"
29 #include "testing/gmock/include/gmock/gmock.h" 29 #include "testing/gmock/include/gmock/gmock.h"
30 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
31 31
32 using Configurator = update_client::Configurator; 32 using Configurator = update_client::Configurator;
33 using Result = update_client::CrxInstaller::Result;
33 using TestConfigurator = update_client::TestConfigurator; 34 using TestConfigurator = update_client::TestConfigurator;
34 using UpdateClient = update_client::UpdateClient; 35 using UpdateClient = update_client::UpdateClient;
35 36
36 using ::testing::_; 37 using ::testing::_;
37 using ::testing::AnyNumber; 38 using ::testing::AnyNumber;
38 using ::testing::Invoke; 39 using ::testing::Invoke;
39 using ::testing::Mock; 40 using ::testing::Mock;
40 using ::testing::Return; 41 using ::testing::Return;
41 42
42 namespace component_updater { 43 namespace component_updater {
43 44
44 class MockInstaller : public CrxInstaller { 45 class MockInstaller : public CrxInstaller {
45 public: 46 public:
46 MockInstaller(); 47 MockInstaller();
47 48
48 MOCK_METHOD1(OnUpdateError, void(int error)); 49 MOCK_METHOD1(OnUpdateError, void(int error));
49 MOCK_METHOD2(Install, 50 MOCK_METHOD2(Install,
50 bool(const base::DictionaryValue& manifest, 51 Result(const base::DictionaryValue& manifest,
51 const base::FilePath& unpack_path)); 52 const base::FilePath& unpack_path));
52 MOCK_METHOD2(GetInstalledFile, 53 MOCK_METHOD2(GetInstalledFile,
53 bool(const std::string& file, base::FilePath* installed_file)); 54 bool(const std::string& file, base::FilePath* installed_file));
54 MOCK_METHOD0(Uninstall, bool()); 55 MOCK_METHOD0(Uninstall, bool());
55 56
56 private: 57 private:
57 ~MockInstaller() override; 58 ~MockInstaller() override;
58 }; 59 };
59 60
60 class MockUpdateClient : public UpdateClient { 61 class MockUpdateClient : public UpdateClient {
61 public: 62 public:
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 base::Bind(&ComponentUpdaterTest::ReadyCallback)); 399 base::Bind(&ComponentUpdaterTest::ReadyCallback));
399 400
400 RunThreads(); 401 RunThreads();
401 402
402 ht.ExpectUniqueSample("ComponentUpdater.Calls", 0, 1); 403 ht.ExpectUniqueSample("ComponentUpdater.Calls", 0, 1);
403 ht.ExpectUniqueSample("ComponentUpdater.UpdateCompleteResult", 0, 1); 404 ht.ExpectUniqueSample("ComponentUpdater.UpdateCompleteResult", 0, 1);
404 ht.ExpectTotalCount("ComponentUpdater.UpdateCompleteTime", 1); 405 ht.ExpectTotalCount("ComponentUpdater.UpdateCompleteTime", 1);
405 } 406 }
406 407
407 } // namespace component_updater 408 } // namespace component_updater
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | components/component_updater/default_component_installer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698