OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_BASE_ANDROID_MOCK_ANDROID_OVERLAY_H_ |
| 6 #define MEDIA_BASE_ANDROID_MOCK_ANDROID_OVERLAY_H_ |
| 7 |
| 8 #include "media/base/android/android_overlay.h" |
| 9 |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" |
| 12 |
| 13 namespace media { |
| 14 |
| 15 // AndroidOverlay implementation that supports weak ptrs. |
| 16 class MockAndroidOverlay : public ::testing::StrictMock<AndroidOverlay> { |
| 17 public: |
| 18 MockAndroidOverlay(); |
| 19 ~MockAndroidOverlay() override; |
| 20 |
| 21 MOCK_METHOD1(ScheduleLayout, void(const gfx::Rect&)); |
| 22 MOCK_CONST_METHOD0(GetJavaSurface, base::android::JavaRef<jobject>&()); |
| 23 |
| 24 // Set |config_|. Sometimes, it's convenient to do this after construction, |
| 25 // especially if one must create the overlay before the factory provides it |
| 26 // via CreateOverlay. That's helpful to set test expectations. |
| 27 void SetConfig(const Config& config); |
| 28 |
| 29 // Send callbacks. |
| 30 void OnOverlayReady(); |
| 31 void OnOverlayFailed(); |
| 32 void OnSurfaceDestroyed(); |
| 33 |
| 34 base::WeakPtr<MockAndroidOverlay> GetWeakPtr() { |
| 35 return weak_factory_.GetWeakPtr(); |
| 36 } |
| 37 |
| 38 private: |
| 39 // Initial configuration, mostly for callbacks. |
| 40 Config config_; |
| 41 |
| 42 base::WeakPtrFactory<MockAndroidOverlay> weak_factory_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(MockAndroidOverlay); |
| 45 }; |
| 46 |
| 47 } // namespace media |
| 48 |
| 49 #endif // MEDIA_BASE_ANDROID_MOCK_ANDROID_OVERLAY_H_ |
OLD | NEW |