Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: components/test_runner/mock_webrtc_peer_connection_handler.h

Issue 1852603002: Replacing most of web_task.h with base::Closure + base::WeakPtrFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-mocks-to-test-runner
Patch Set: Rebasing... Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_PEER_CONNECTION_HANDLER_H_ 5 #ifndef COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_PEER_CONNECTION_HANDLER_H_
6 #define COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_PEER_CONNECTION_HANDLER_H_ 6 #define COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_PEER_CONNECTION_HANDLER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "components/test_runner/web_task.h" 11 #include "base/memory/weak_ptr.h"
12 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandler.h" 12 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandler.h"
13 #include "third_party/WebKit/public/platform/WebRTCSessionDescription.h" 13 #include "third_party/WebKit/public/platform/WebRTCSessionDescription.h"
14 #include "third_party/WebKit/public/platform/WebRTCSessionDescriptionRequest.h" 14 #include "third_party/WebKit/public/platform/WebRTCSessionDescriptionRequest.h"
15 #include "third_party/WebKit/public/platform/WebRTCStatsRequest.h" 15 #include "third_party/WebKit/public/platform/WebRTCStatsRequest.h"
16 16
17 namespace blink { 17 namespace blink {
18 class WebRTCPeerConnectionHandlerClient; 18 class WebRTCPeerConnectionHandlerClient;
19 }; 19 };
20 20
21 namespace test_runner { 21 namespace test_runner {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 const blink::WebMediaConstraints& constraints) override; 58 const blink::WebMediaConstraints& constraints) override;
59 void removeStream(const blink::WebMediaStream& stream) override; 59 void removeStream(const blink::WebMediaStream& stream) override;
60 void getStats(const blink::WebRTCStatsRequest& request) override; 60 void getStats(const blink::WebRTCStatsRequest& request) override;
61 blink::WebRTCDataChannelHandler* createDataChannel( 61 blink::WebRTCDataChannelHandler* createDataChannel(
62 const blink::WebString& label, 62 const blink::WebString& label,
63 const blink::WebRTCDataChannelInit& init) override; 63 const blink::WebRTCDataChannelInit& init) override;
64 blink::WebRTCDTMFSenderHandler* createDTMFSender( 64 blink::WebRTCDTMFSenderHandler* createDTMFSender(
65 const blink::WebMediaStreamTrack& track) override; 65 const blink::WebMediaStreamTrack& track) override;
66 void stop() override; 66 void stop() override;
67 67
68 // WebTask related methods
69 WebTaskList* mutable_task_list() { return &task_list_; }
70
71 private: 68 private:
72 MockWebRTCPeerConnectionHandler(); 69 MockWebRTCPeerConnectionHandler();
73 70
74 // UpdateRemoteStreams uses the collection of |local_streams_| to create 71 // UpdateRemoteStreams uses the collection of |local_streams_| to create
75 // remote MediaStreams with the same number of tracks and notifies |client_| 72 // remote MediaStreams with the same number of tracks and notifies |client_|
76 // about added and removed streams. It's triggered when setRemoteDescription 73 // about added and removed streams. It's triggered when setRemoteDescription
77 // is called. 74 // is called.
78 void UpdateRemoteStreams(); 75 void UpdateRemoteStreams();
79 76
77 void ReportInitializeCompleted();
78 void ReportCreationOfDataChannel();
79
80 void PostRequestResult(
81 const blink::WebRTCSessionDescriptionRequest& request,
82 const blink::WebRTCSessionDescription& session_description);
83 void PostRequestFailure(
84 const blink::WebRTCSessionDescriptionRequest& request);
85 void PostRequestResult(const blink::WebRTCVoidRequest& request);
86 void PostRequestFailure(const blink::WebRTCVoidRequest& request);
87
80 blink::WebRTCPeerConnectionHandlerClient* client_; 88 blink::WebRTCPeerConnectionHandlerClient* client_;
81 bool stopped_; 89 bool stopped_;
82 WebTaskList task_list_;
83 blink::WebRTCSessionDescription local_description_; 90 blink::WebRTCSessionDescription local_description_;
84 blink::WebRTCSessionDescription remote_description_; 91 blink::WebRTCSessionDescription remote_description_;
85 int stream_count_; 92 int stream_count_;
86 TestInterfaces* interfaces_; 93 TestInterfaces* interfaces_;
87 typedef std::map<std::string, blink::WebMediaStream> StreamMap; 94 typedef std::map<std::string, blink::WebMediaStream> StreamMap;
88 StreamMap local_streams_; 95 StreamMap local_streams_;
89 StreamMap remote_streams_; 96 StreamMap remote_streams_;
90 97
98 base::WeakPtrFactory<MockWebRTCPeerConnectionHandler> weak_factory_;
99
91 DISALLOW_COPY_AND_ASSIGN(MockWebRTCPeerConnectionHandler); 100 DISALLOW_COPY_AND_ASSIGN(MockWebRTCPeerConnectionHandler);
92 }; 101 };
93 102
94 } // namespace test_runner 103 } // namespace test_runner
95 104
96 #endif // COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_PEER_CONNECTION_HANDLER_H_ 105 #endif // COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_PEER_CONNECTION_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698