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

Side by Side Diff: components/test_runner/mock_webrtc_data_channel_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_DATA_CHANNEL_HANDLER_H_ 5 #ifndef COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_DATA_CHANNEL_HANDLER_H_
6 #define COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_DATA_CHANNEL_HANDLER_H_ 6 #define COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_DATA_CHANNEL_HANDLER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
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/WebRTCDataChannelHandler.h" 12 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandler.h"
13 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandlerClient.h" 13 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandlerClient.h"
14 #include "third_party/WebKit/public/platform/WebRTCDataChannelInit.h" 14 #include "third_party/WebKit/public/platform/WebRTCDataChannelInit.h"
15 #include "third_party/WebKit/public/platform/WebString.h" 15 #include "third_party/WebKit/public/platform/WebString.h"
16 16
17 namespace test_runner { 17 namespace test_runner {
18 18
19 class WebTestDelegate; 19 class WebTestDelegate;
20 20
21 class MockWebRTCDataChannelHandler : public blink::WebRTCDataChannelHandler { 21 class MockWebRTCDataChannelHandler : public blink::WebRTCDataChannelHandler {
22 public: 22 public:
23 MockWebRTCDataChannelHandler(blink::WebString label, 23 MockWebRTCDataChannelHandler(blink::WebString label,
24 const blink::WebRTCDataChannelInit& init, 24 const blink::WebRTCDataChannelInit& init,
25 WebTestDelegate* delegate); 25 WebTestDelegate* delegate);
26 ~MockWebRTCDataChannelHandler() override;
26 27
27 // WebRTCDataChannelHandler related methods 28 // WebRTCDataChannelHandler related methods
28 void setClient(blink::WebRTCDataChannelHandlerClient* client) override; 29 void setClient(blink::WebRTCDataChannelHandlerClient* client) override;
29 blink::WebString label() override; 30 blink::WebString label() override;
30 bool isReliable() override; 31 bool isReliable() override;
31 bool ordered() const override; 32 bool ordered() const override;
32 unsigned short maxRetransmitTime() const override; 33 unsigned short maxRetransmitTime() const override;
33 unsigned short maxRetransmits() const override; 34 unsigned short maxRetransmits() const override;
34 blink::WebString protocol() const override; 35 blink::WebString protocol() const override;
35 bool negotiated() const override; 36 bool negotiated() const override;
36 unsigned short id() const override; 37 unsigned short id() const override;
37 blink::WebRTCDataChannelHandlerClient::ReadyState state() const override; 38 blink::WebRTCDataChannelHandlerClient::ReadyState state() const override;
38 unsigned long bufferedAmount() override; 39 unsigned long bufferedAmount() override;
39 bool sendStringData(const blink::WebString& data) override; 40 bool sendStringData(const blink::WebString& data) override;
40 bool sendRawData(const char* data, size_t size) override; 41 bool sendRawData(const char* data, size_t size) override;
41 void close() override; 42 void close() override;
42 43
43 // WebTask related methods
44 WebTaskList* mutable_task_list() { return &task_list_; }
45
46 private: 44 private:
47 MockWebRTCDataChannelHandler(); 45 MockWebRTCDataChannelHandler();
46 void ReportOpenedState();
47 void ReportClosedState();
48 48
49 blink::WebRTCDataChannelHandlerClient* client_; 49 blink::WebRTCDataChannelHandlerClient* client_;
50 blink::WebString label_; 50 blink::WebString label_;
51 blink::WebRTCDataChannelInit init_; 51 blink::WebRTCDataChannelInit init_;
52 bool reliable_; 52 bool reliable_;
53 WebTaskList task_list_;
54 WebTestDelegate* delegate_; 53 WebTestDelegate* delegate_;
55 54
55 base::WeakPtrFactory<MockWebRTCDataChannelHandler> weak_factory_;
56
56 DISALLOW_COPY_AND_ASSIGN(MockWebRTCDataChannelHandler); 57 DISALLOW_COPY_AND_ASSIGN(MockWebRTCDataChannelHandler);
57 }; 58 };
58 59
59 } // namespace test_runner 60 } // namespace test_runner
60 61
61 #endif // COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_DATA_CHANNEL_HANDLER_H_ 62 #endif // COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_DATA_CHANNEL_HANDLER_H_
OLDNEW
« no previous file with comments | « components/test_runner/mock_web_user_media_client.cc ('k') | components/test_runner/mock_webrtc_data_channel_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698