Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef MODULES_UTILITY_INCLUDE_MOCK_MOCK_PROCESS_THREAD_H_ |
| 12 | #define MODULES_UTILITY_INCLUDE_MOCK_MOCK_PROCESS_THREAD_H_ |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 13 | |
kwiberg | 22feaa3 | 2016-03-17 09:17:43 -0700 | [diff] [blame] | 14 | #include <memory> |
| 15 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 16 | #include "modules/utility/include/process_thread.h" |
| 17 | #include "rtc_base/location.h" |
| 18 | #include "test/gmock.h" |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 19 | |
| 20 | namespace webrtc { |
| 21 | |
| 22 | class MockProcessThread : public ProcessThread { |
| 23 | public: |
nisse | ef8b61e | 2016-04-29 06:09:15 -0700 | [diff] [blame] | 24 | // TODO(nisse): Valid overrides commented out, because the gmock |
| 25 | // methods don't use any override declarations, and we want to avoid |
| 26 | // warnings from -Winconsistent-missing-override. See |
| 27 | // http://crbug.com/428099. |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 28 | MOCK_METHOD0(Start, void()); |
| 29 | MOCK_METHOD0(Stop, void()); |
| 30 | MOCK_METHOD1(WakeUp, void(Module* module)); |
tommi | 435f98b | 2016-05-28 14:57:15 -0700 | [diff] [blame] | 31 | MOCK_METHOD1(PostTask, void(rtc::QueuedTask* task)); |
tommi | dea489f | 2017-03-03 03:20:24 -0800 | [diff] [blame] | 32 | MOCK_METHOD2(RegisterModule, void(Module* module, const rtc::Location&)); |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 33 | MOCK_METHOD1(DeRegisterModule, void(Module* module)); |
| 34 | |
| 35 | // MOCK_METHOD1 gets confused with mocking this method, so we work around it |
| 36 | // by overriding the method from the interface and forwarding the call to a |
| 37 | // mocked, simpler method. |
tommi | 435f98b | 2016-05-28 14:57:15 -0700 | [diff] [blame] | 38 | void PostTask(std::unique_ptr<rtc::QueuedTask> task) /*override*/ { |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 39 | PostTask(task.get()); |
| 40 | } |
| 41 | }; |
| 42 | |
| 43 | } // namespace webrtc |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 44 | #endif // MODULES_UTILITY_INCLUDE_MOCK_MOCK_PROCESS_THREAD_H_ |