avs-device-sdk/ACL/test/Transport/MockHTTP2Request.h

115 lines
3.3 KiB
C
Raw Normal View History

Version 1.10 alexa-client-sdk Changes in this update: **Enhancements** * New optional configuration for [EqualizerController](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L154). The EqualizerController interface allows you to adjust equalizer settings on your product, such as decibel (dB) levels and modes. * Added reference implementation of the EqualizerController for GStreamer-based (MacOS, Linux, and Raspberry Pi) and OpenSL ES-based (Android) MediaPlayers. Note: In order to use with Android, it must support OpenSL ES. * New optional configuration for the [TemplateRuntime display card value](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L144). * A configuration file generator script, `genConfig.sh` is now included with the SDK in the **tools/Install** directory. `genConfig.sh` and it's associated arguments populate `AlexaClientSDKConfig.json` with the data required to authorize with LWA. * Added Bluetooth A2DP source and AVRCP target support for Linux. * Added Amazon for Business (A4B) support, which includes support for handling the new [RevokeAuthorization](https://developer.amazon.com/docs/alexa-voice-service/system.html#revokeauth) directive in the Settings interface. A new CMake option has been added to enable A4B within the SDK, `-DA4B`. * Added locale support for IT and ES. * The Alexa Communication Library (ACL), `CBLAUthDelegate`, and sample app have been enhanced to detect de-authorization using the new `z` command. * Added `ExternalMediaPlayerObserver`, which receives notification of player state, track, and username changes. * `HTTP2ConnectionInterface` was factored out of `HTTP2Transport` to enable unit testing of `HTTP2Transport` and re-use of `HTTP2Connection` logic. **Bug Fixes** * Fixed a bug in which `ExternalMediaPlayer` adapter playback wasn't being recognized by AVS. * [Issue 973](https://github.com/alexa/avs-device-sdk/issues/973) - Fixed issues related to `AudioPlayer` where progress reports were being sent out of order or with incorrect offsets. * An `EXPECTING`, state has been added to `DialogUXState` in order to handle `EXPECT_SPEECH` state for hold-to-talk devices. * [Issue 948](https://github.com/alexa/avs-device-sdk/issues/948) - Fixed a bug in which the sample app was stuck in a listening state. * Fixed a bug where there was a delay between receiving a `DeleteAlert` directive, and deleting the alert. * [Issue 839](https://github.com/alexa/avs-device-sdk/issues/839) - Fixed an issue where speech was being truncated due to the `DialogUXStateAggregator` transitioning between a `THINKING` and `IDLE` state. * Fixed a bug in which the `AudioPlayer` attempted to play when it wasn't in the `FOREGROUND` focus. * `CapabilitiesDelegateTest` now works on Android. * [Issue 950](https://github.com/alexa/avs-device-sdk/issues/950) - Improved Android Media Player audio quality. * [Issue 908](https://github.com/alexa/avs-device-sdk/issues/908) - Fixed compile error on g++ 7.x in which includes were missing.
2018-10-24 17:01:29 +00:00
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
Version 1.10 alexa-client-sdk Changes in this update: **Enhancements** * New optional configuration for [EqualizerController](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L154). The EqualizerController interface allows you to adjust equalizer settings on your product, such as decibel (dB) levels and modes. * Added reference implementation of the EqualizerController for GStreamer-based (MacOS, Linux, and Raspberry Pi) and OpenSL ES-based (Android) MediaPlayers. Note: In order to use with Android, it must support OpenSL ES. * New optional configuration for the [TemplateRuntime display card value](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L144). * A configuration file generator script, `genConfig.sh` is now included with the SDK in the **tools/Install** directory. `genConfig.sh` and it's associated arguments populate `AlexaClientSDKConfig.json` with the data required to authorize with LWA. * Added Bluetooth A2DP source and AVRCP target support for Linux. * Added Amazon for Business (A4B) support, which includes support for handling the new [RevokeAuthorization](https://developer.amazon.com/docs/alexa-voice-service/system.html#revokeauth) directive in the Settings interface. A new CMake option has been added to enable A4B within the SDK, `-DA4B`. * Added locale support for IT and ES. * The Alexa Communication Library (ACL), `CBLAUthDelegate`, and sample app have been enhanced to detect de-authorization using the new `z` command. * Added `ExternalMediaPlayerObserver`, which receives notification of player state, track, and username changes. * `HTTP2ConnectionInterface` was factored out of `HTTP2Transport` to enable unit testing of `HTTP2Transport` and re-use of `HTTP2Connection` logic. **Bug Fixes** * Fixed a bug in which `ExternalMediaPlayer` adapter playback wasn't being recognized by AVS. * [Issue 973](https://github.com/alexa/avs-device-sdk/issues/973) - Fixed issues related to `AudioPlayer` where progress reports were being sent out of order or with incorrect offsets. * An `EXPECTING`, state has been added to `DialogUXState` in order to handle `EXPECT_SPEECH` state for hold-to-talk devices. * [Issue 948](https://github.com/alexa/avs-device-sdk/issues/948) - Fixed a bug in which the sample app was stuck in a listening state. * Fixed a bug where there was a delay between receiving a `DeleteAlert` directive, and deleting the alert. * [Issue 839](https://github.com/alexa/avs-device-sdk/issues/839) - Fixed an issue where speech was being truncated due to the `DialogUXStateAggregator` transitioning between a `THINKING` and `IDLE` state. * Fixed a bug in which the `AudioPlayer` attempted to play when it wasn't in the `FOREGROUND` focus. * `CapabilitiesDelegateTest` now works on Android. * [Issue 950](https://github.com/alexa/avs-device-sdk/issues/950) - Improved Android Media Player audio quality. * [Issue 908](https://github.com/alexa/avs-device-sdk/issues/908) - Fixed compile error on g++ 7.x in which includes were missing.
2018-10-24 17:01:29 +00:00
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#ifndef ALEXA_CLIENT_SDK_ACL_TEST_TRANSPORT_MOCKHTTP2REQUEST_H_
#define ALEXA_CLIENT_SDK_ACL_TEST_TRANSPORT_MOCKHTTP2REQUEST_H_
#include <memory>
#include <string>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <AVSCommon/Utils/HTTP2/HTTP2MimeResponseDecoder.h>
#include <AVSCommon/Utils/HTTP2/HTTP2RequestConfig.h>
#include <AVSCommon/Utils/HTTP2/HTTP2RequestInterface.h>
#include "MockMimeResponseSink.h"
namespace alexaClientSDK {
namespace avsCommon {
namespace utils {
namespace http2 {
namespace test {
/**
* A mock class of @c HTTP2RequestInterface.
*/
class MockHTTP2Request : public HTTP2RequestInterface {
public:
MockHTTP2Request(const alexaClientSDK::avsCommon::utils::http2::HTTP2RequestConfig& config);
MOCK_METHOD0(cancel, bool());
MOCK_CONST_METHOD0(getId, std::string());
/**
* Retrieve the URL for the request.
*
* @return The request URL.
*/
const std::string getUrl();
/**
* Retrieve the HTTP2 request source.
*
* @return The HTTP2 request source.
*/
std::shared_ptr<HTTP2RequestSourceInterface> getSource();
/**
* Retrieve the HTTP2 request sink.
*
* @return The HTTP2 request sink.
*/
std::shared_ptr<HTTP2ResponseSinkInterface> getSink();
/**
* Retrieve the HTTP2 request type.
*
* @return The HTTP2 request type.
*/
HTTP2RequestType getRequestType();
/**
* Retrieve The MIME response sink that contains the parsed mime contents of the HTTP2 request.
*
* @return The pointer to the MIME response sink.
*/
std::shared_ptr<acl::test::MockMimeResponseSink> getMimeResponseSink();
/**
* Retrieve The MIME response decoder of the HTTP2 request.
*
* @return The pointer to the MIME response decoder.
*/
std::shared_ptr<HTTP2MimeResponseDecoder> getMimeDecoder();
private:
/// The URL to receive the request.
const std::string m_url;
/// The object to provide the data for this HTTP2 POST request.
std::shared_ptr<HTTP2RequestSourceInterface> m_source;
/// The object to receive the response to this HTTP2 request.
std::shared_ptr<HTTP2ResponseSinkInterface> m_sink;
/// The HTTP Request Type.
HTTP2RequestType m_type;
/// The MIME response sink that contains the parsed mime contents of the HTTP2 request.
std::shared_ptr<acl::test::MockMimeResponseSink> m_mimeResponseSink;
/// An instance of the @c HTTP2MimeResponseDecoder which decodes the contents of an HTTP2 request.
std::shared_ptr<HTTP2MimeResponseDecoder> m_mimeDecoder;
};
} // namespace test
} // namespace http2
} // namespace utils
} // namespace avsCommon
} // namespace alexaClientSDK
#endif /* ALEXA_CLIENT_SDK_ACL_TEST_TRANSPORT_MOCKHTTP2REQUEST_H_ */