AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
MockPowerResourceManager.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_TEST_AVSCOMMON_SDKINTERFACES_MOCKPOWERRESOURCEMANAGER_H_
17 #define ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_TEST_AVSCOMMON_SDKINTERFACES_MOCKPOWERRESOURCEMANAGER_H_
18 
19 #include <memory>
20 
21 #include <gmock/gmock.h>
22 
24 
25 namespace alexaClientSDK {
26 namespace avsCommon {
27 namespace sdkInterfaces {
28 namespace test {
29 
34 public:
35  MOCK_METHOD2(acquirePowerResource, void(const std::string& component, const PowerResourceLevel level));
36  MOCK_METHOD1(releasePowerResource, void(const std::string& component));
37  MOCK_METHOD1(isPowerResourceAcquired, bool(const std::string& component));
39  create,
40  std::shared_ptr<PowerResourceId>(
41  const std::string& resourceId,
42  bool isRefCounted,
43  const PowerResourceLevel level));
45  acquire,
46  bool(const std::shared_ptr<PowerResourceId>& id, const std::chrono::milliseconds autoReleaseTimeout));
47  MOCK_METHOD1(release, bool(const std::shared_ptr<PowerResourceId>& id));
48  MOCK_METHOD1(close, bool(const std::shared_ptr<PowerResourceId>& id));
49 
53  void setDefaultBehavior();
54 };
55 
58  .WillByDefault(
59  testing::Invoke([](const std::string& resourceId,
60  bool isRefCounted,
62  return std::make_shared<PowerResourceManagerInterface::PowerResourceId>(resourceId);
63  }));
64 }
65 
66 } // namespace test
67 } // namespace sdkInterfaces
68 } // namespace avsCommon
69 } // namespace alexaClientSDK
70 
71 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_TEST_AVSCOMMON_SDKINTERFACES_MOCKPOWERRESOURCEMANAGER_H_
PowerResourceLevel
Definition: PowerResourceManagerInterface.h:49
virtual void acquirePowerResource(const std::string &component, const PowerResourceLevel level=PowerResourceLevel::STANDBY_MED)=0
Definition: AmdMetricWrapperTest.cpp:24
::std::string string
Definition: gtest-port.h:1097
MOCK_METHOD2(acquirePowerResource, void(const std::string &component, const PowerResourceLevel level))
virtual bool isPowerResourceAcquired(const std::string &component)=0
virtual void releasePowerResource(const std::string &component)=0
#define ON_CALL(obj, call)
Definition: gmock-spec-builders.h:1841
MOCK_METHOD1(releasePowerResource, void(const std::string &component))
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
Definition: gmock-more-actions.h:114
virtual std::shared_ptr< PowerResourceId > create(const std::string &resourceId, bool isRefCounted=true, const PowerResourceLevel level=PowerResourceLevel::STANDBY_MED)=0
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
virtual bool release(const std::shared_ptr< PowerResourceId > &id)=0
virtual bool close(const std::shared_ptr< PowerResourceId > &id)=0
const internal::AnythingMatcher _
Definition: gmock-matchers.h:3729
void setDefaultBehavior()
Definition: MockPowerResourceManager.h:56
virtual bool acquire(const std::shared_ptr< PowerResourceId > &id, const std::chrono::milliseconds autoReleaseTimeout=std::chrono::milliseconds::zero())=0
MOCK_METHOD3(create, std::shared_ptr< PowerResourceId >(const std::string &resourceId, bool isRefCounted, const PowerResourceLevel level))

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0