blob: fb88e40074c9daa661c2fd084f6ac2f79c8417c6 [file] [log] [blame]
Henrik Kjellanderff761fb2015-11-04 08:31:52 +01001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_UTILITY_INCLUDE_MOCK_MOCK_PROCESS_THREAD_H_
12#define MODULES_UTILITY_INCLUDE_MOCK_MOCK_PROCESS_THREAD_H_
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010013
kwiberg22feaa32016-03-17 09:17:43 -070014#include <memory>
15
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "modules/utility/include/process_thread.h"
17#include "rtc_base/location.h"
18#include "test/gmock.h"
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010019
20namespace webrtc {
21
22class MockProcessThread : public ProcessThread {
23 public:
nisseef8b61e2016-04-29 06:09:15 -070024 // 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 Kjellanderff761fb2015-11-04 08:31:52 +010028 MOCK_METHOD0(Start, void());
29 MOCK_METHOD0(Stop, void());
30 MOCK_METHOD1(WakeUp, void(Module* module));
tommi435f98b2016-05-28 14:57:15 -070031 MOCK_METHOD1(PostTask, void(rtc::QueuedTask* task));
tommidea489f2017-03-03 03:20:24 -080032 MOCK_METHOD2(RegisterModule, void(Module* module, const rtc::Location&));
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010033 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.
tommi435f98b2016-05-28 14:57:15 -070038 void PostTask(std::unique_ptr<rtc::QueuedTask> task) /*override*/ {
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010039 PostTask(task.get());
40 }
41};
42
43} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020044#endif // MODULES_UTILITY_INCLUDE_MOCK_MOCK_PROCESS_THREAD_H_