• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 
16 #ifndef STREAM_UPDATE_UNITTEST_H
17 #define STREAM_UPDATE_UNITTEST_H
18 
19 #include <gmock/gmock.h>
20 #include <gtest/gtest.h>
21 #include "stream_status_manager.h"
22 #include "stream_update.h"
23 
24 namespace OHOS {
25 namespace SysInstaller {
26 
27 class MockStatusManager : public StreamStatusManager {
28 public:
29     MOCK_METHOD(void, UpdateCallback, (UpdateStatus updateStatus, int dealLen,
30         const std::string &resultMsg), (override));
31 };
32 
33 class StreamInstallProcesserTest : public ::testing::Test {
34 protected:
35     std::shared_ptr<MockStatusManager > statusManager {};
36 
SetUp()37     void SetUp() override
38     {
39         statusManager = std::make_shared<MockStatusManager >();
40         statusManager->Init();
41         StreamInstallProcesser::GetInstance().SetStatusManager(statusManager);
42     }
43 
TearDown()44     void TearDown() override
45     {
46     }
47 };
48 
49 } // SysInstaller
50 } // OHOS
51 #endif // STREAM_UPDATE_UNITTEST_H
52