| Index: media/base/android/mock_android_overlay.h
|
| diff --git a/media/base/android/mock_android_overlay.h b/media/base/android/mock_android_overlay.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..174d552ec4a306c1ff3ab3ac16b1de30951c21c3
|
| --- /dev/null
|
| +++ b/media/base/android/mock_android_overlay.h
|
| @@ -0,0 +1,49 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef MEDIA_BASE_ANDROID_MOCK_ANDROID_OVERLAY_H_
|
| +#define MEDIA_BASE_ANDROID_MOCK_ANDROID_OVERLAY_H_
|
| +
|
| +#include "media/base/android/android_overlay.h"
|
| +
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "testing/gmock/include/gmock/gmock.h"
|
| +
|
| +namespace media {
|
| +
|
| +// AndroidOverlay implementation that supports weak ptrs.
|
| +class MockAndroidOverlay : public ::testing::StrictMock<AndroidOverlay> {
|
| + public:
|
| + MockAndroidOverlay();
|
| + ~MockAndroidOverlay() override;
|
| +
|
| + MOCK_METHOD1(ScheduleLayout, void(const gfx::Rect&));
|
| + MOCK_CONST_METHOD0(GetJavaSurface, base::android::JavaRef<jobject>&());
|
| +
|
| + // Set |config_|. Sometimes, it's convenient to do this after construction,
|
| + // especially if one must create the overlay before the factory provides it
|
| + // via CreateOverlay. That's helpful to set test expectations.
|
| + void SetConfig(const Config& config);
|
| +
|
| + // Send callbacks.
|
| + void OnOverlayReady();
|
| + void OnOverlayFailed();
|
| + void OnSurfaceDestroyed();
|
| +
|
| + base::WeakPtr<MockAndroidOverlay> GetWeakPtr() {
|
| + return weak_factory_.GetWeakPtr();
|
| + }
|
| +
|
| + private:
|
| + // Initial configuration, mostly for callbacks.
|
| + Config config_;
|
| +
|
| + base::WeakPtrFactory<MockAndroidOverlay> weak_factory_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(MockAndroidOverlay);
|
| +};
|
| +
|
| +} // namespace media
|
| +
|
| +#endif // MEDIA_BASE_ANDROID_MOCK_ANDROID_OVERLAY_H_
|
|
|