| OLD | NEW |
| 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 Loading... |
| 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; | |
| 34 using TestConfigurator = update_client::TestConfigurator; | 33 using TestConfigurator = update_client::TestConfigurator; |
| 35 using UpdateClient = update_client::UpdateClient; | 34 using UpdateClient = update_client::UpdateClient; |
| 36 | 35 |
| 37 using ::testing::_; | 36 using ::testing::_; |
| 38 using ::testing::AnyNumber; | 37 using ::testing::AnyNumber; |
| 39 using ::testing::Invoke; | 38 using ::testing::Invoke; |
| 40 using ::testing::Mock; | 39 using ::testing::Mock; |
| 41 using ::testing::Return; | 40 using ::testing::Return; |
| 42 | 41 |
| 43 namespace component_updater { | 42 namespace component_updater { |
| 44 | 43 |
| 45 class MockInstaller : public CrxInstaller { | 44 class MockInstaller : public CrxInstaller { |
| 46 public: | 45 public: |
| 47 MockInstaller(); | 46 MockInstaller(); |
| 48 | 47 |
| 49 MOCK_METHOD1(OnUpdateError, void(int error)); | 48 MOCK_METHOD1(OnUpdateError, void(int error)); |
| 50 MOCK_METHOD2(Install, | 49 MOCK_METHOD2(Install, |
| 51 Result(const base::DictionaryValue& manifest, | 50 bool(const base::DictionaryValue& manifest, |
| 52 const base::FilePath& unpack_path)); | 51 const base::FilePath& unpack_path)); |
| 53 MOCK_METHOD2(GetInstalledFile, | 52 MOCK_METHOD2(GetInstalledFile, |
| 54 bool(const std::string& file, base::FilePath* installed_file)); | 53 bool(const std::string& file, base::FilePath* installed_file)); |
| 55 MOCK_METHOD0(Uninstall, bool()); | 54 MOCK_METHOD0(Uninstall, bool()); |
| 56 | 55 |
| 57 private: | 56 private: |
| 58 ~MockInstaller() override; | 57 ~MockInstaller() override; |
| 59 }; | 58 }; |
| 60 | 59 |
| 61 class MockUpdateClient : public UpdateClient { | 60 class MockUpdateClient : public UpdateClient { |
| 62 public: | 61 public: |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 base::Bind(&ComponentUpdaterTest::ReadyCallback)); | 398 base::Bind(&ComponentUpdaterTest::ReadyCallback)); |
| 400 | 399 |
| 401 RunThreads(); | 400 RunThreads(); |
| 402 | 401 |
| 403 ht.ExpectUniqueSample("ComponentUpdater.Calls", 0, 1); | 402 ht.ExpectUniqueSample("ComponentUpdater.Calls", 0, 1); |
| 404 ht.ExpectUniqueSample("ComponentUpdater.UpdateCompleteResult", 0, 1); | 403 ht.ExpectUniqueSample("ComponentUpdater.UpdateCompleteResult", 0, 1); |
| 405 ht.ExpectTotalCount("ComponentUpdater.UpdateCompleteTime", 1); | 404 ht.ExpectTotalCount("ComponentUpdater.UpdateCompleteTime", 1); |
| 406 } | 405 } |
| 407 | 406 |
| 408 } // namespace component_updater | 407 } // namespace component_updater |
| OLD | NEW |