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

Side by Side Diff: third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp

Issue 2967013002: Be explicit about namespace testing to not mix it with blink::testing (Closed)
Patch Set: Dropped mojo parts that need another review. Created 3 years, 5 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 #include "modules/websockets/DocumentWebSocketChannel.h" 5 #include "modules/websockets/DocumentWebSocketChannel.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <memory> 8 #include <memory>
9 #include "core/dom/DOMArrayBuffer.h" 9 #include "core/dom/DOMArrayBuffer.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
11 #include "core/fileapi/Blob.h" 11 #include "core/fileapi/Blob.h"
12 #include "core/testing/DummyPageHolder.h" 12 #include "core/testing/DummyPageHolder.h"
13 #include "modules/websockets/WebSocketChannel.h" 13 #include "modules/websockets/WebSocketChannel.h"
14 #include "modules/websockets/WebSocketChannelClient.h" 14 #include "modules/websockets/WebSocketChannelClient.h"
15 #include "modules/websockets/WebSocketHandle.h" 15 #include "modules/websockets/WebSocketHandle.h"
16 #include "modules/websockets/WebSocketHandleClient.h" 16 #include "modules/websockets/WebSocketHandleClient.h"
17 #include "platform/heap/Handle.h" 17 #include "platform/heap/Handle.h"
18 #include "platform/weborigin/KURL.h" 18 #include "platform/weborigin/KURL.h"
19 #include "platform/wtf/PtrUtil.h" 19 #include "platform/wtf/PtrUtil.h"
20 #include "platform/wtf/Vector.h" 20 #include "platform/wtf/Vector.h"
21 #include "platform/wtf/text/WTFString.h" 21 #include "platform/wtf/text/WTFString.h"
22 #include "public/platform/WebCallbacks.h" 22 #include "public/platform/WebCallbacks.h"
23 #include "public/platform/WebSocketHandshakeThrottle.h" 23 #include "public/platform/WebSocketHandshakeThrottle.h"
24 #include "public/platform/WebURL.h" 24 #include "public/platform/WebURL.h"
25 #include "public/web/WebLocalFrame.h" 25 #include "public/web/WebLocalFrame.h"
26 #include "testing/gmock/include/gmock/gmock.h" 26 #include "testing/gmock/include/gmock/gmock.h"
27 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
28 28
29 using testing::_; 29 using ::testing::_;
30 using testing::InSequence; 30 using ::testing::InSequence;
31 using testing::PrintToString; 31 using ::testing::PrintToString;
32 using testing::AnyNumber; 32 using ::testing::AnyNumber;
33 using testing::SaveArg; 33 using ::testing::SaveArg;
34 34
35 namespace blink { 35 namespace blink {
36 36
37 namespace { 37 namespace {
38 38
39 typedef testing::StrictMock<testing::MockFunction<void(int)>> Checkpoint; 39 typedef ::testing::StrictMock<::testing::MockFunction<void(int)>> Checkpoint;
40 40
41 class MockWebSocketChannelClient 41 class MockWebSocketChannelClient
42 : public GarbageCollectedFinalized<MockWebSocketChannelClient>, 42 : public GarbageCollectedFinalized<MockWebSocketChannelClient>,
43 public WebSocketChannelClient { 43 public WebSocketChannelClient {
44 USING_GARBAGE_COLLECTED_MIXIN(MockWebSocketChannelClient); 44 USING_GARBAGE_COLLECTED_MIXIN(MockWebSocketChannelClient);
45 45
46 public: 46 public:
47 static MockWebSocketChannelClient* Create() { 47 static MockWebSocketChannelClient* Create() {
48 return new testing::StrictMock<MockWebSocketChannelClient>(); 48 return new ::testing::StrictMock<MockWebSocketChannelClient>();
49 } 49 }
50 50
51 MockWebSocketChannelClient() {} 51 MockWebSocketChannelClient() {}
52 52
53 ~MockWebSocketChannelClient() override {} 53 ~MockWebSocketChannelClient() override {}
54 54
55 MOCK_METHOD2(DidConnect, void(const String&, const String&)); 55 MOCK_METHOD2(DidConnect, void(const String&, const String&));
56 MOCK_METHOD1(DidReceiveTextMessage, void(const String&)); 56 MOCK_METHOD1(DidReceiveTextMessage, void(const String&));
57 void DidReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload) override { 57 void DidReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload) override {
58 DidReceiveBinaryMessageMock(*payload); 58 DidReceiveBinaryMessageMock(*payload);
59 } 59 }
60 MOCK_METHOD1(DidReceiveBinaryMessageMock, void(const Vector<char>&)); 60 MOCK_METHOD1(DidReceiveBinaryMessageMock, void(const Vector<char>&));
61 MOCK_METHOD0(DidError, void()); 61 MOCK_METHOD0(DidError, void());
62 MOCK_METHOD1(DidConsumeBufferedAmount, void(uint64_t)); 62 MOCK_METHOD1(DidConsumeBufferedAmount, void(uint64_t));
63 MOCK_METHOD0(DidStartClosingHandshake, void()); 63 MOCK_METHOD0(DidStartClosingHandshake, void());
64 MOCK_METHOD3(DidClose, 64 MOCK_METHOD3(DidClose,
65 void(ClosingHandshakeCompletionStatus, 65 void(ClosingHandshakeCompletionStatus,
66 unsigned short, 66 unsigned short,
67 const String&)); 67 const String&));
68 68
69 DEFINE_INLINE_VIRTUAL_TRACE() { WebSocketChannelClient::Trace(visitor); } 69 DEFINE_INLINE_VIRTUAL_TRACE() { WebSocketChannelClient::Trace(visitor); }
70 }; 70 };
71 71
72 class MockWebSocketHandle : public WebSocketHandle { 72 class MockWebSocketHandle : public WebSocketHandle {
73 public: 73 public:
74 static MockWebSocketHandle* Create() { 74 static MockWebSocketHandle* Create() {
75 return new testing::StrictMock<MockWebSocketHandle>(); 75 return new ::testing::StrictMock<MockWebSocketHandle>();
76 } 76 }
77 77
78 MockWebSocketHandle() {} 78 MockWebSocketHandle() {}
79 79
80 ~MockWebSocketHandle() override {} 80 ~MockWebSocketHandle() override {}
81 81
82 MOCK_METHOD1(DoInitialize, void(mojom::blink::WebSocketPtr*)); 82 MOCK_METHOD1(DoInitialize, void(mojom::blink::WebSocketPtr*));
83 void Initialize(mojom::blink::WebSocketPtr websocket) override { 83 void Initialize(mojom::blink::WebSocketPtr websocket) override {
84 DoInitialize(&websocket); 84 DoInitialize(&websocket);
85 } 85 }
86 86
87 MOCK_METHOD6(Connect, 87 MOCK_METHOD6(Connect,
88 void(const KURL&, 88 void(const KURL&,
89 const Vector<String>&, 89 const Vector<String>&,
90 SecurityOrigin*, 90 SecurityOrigin*,
91 const KURL&, 91 const KURL&,
92 const String&, 92 const String&,
93 WebSocketHandleClient*)); 93 WebSocketHandleClient*));
94 MOCK_METHOD4(Send, 94 MOCK_METHOD4(Send,
95 void(bool, WebSocketHandle::MessageType, const char*, size_t)); 95 void(bool, WebSocketHandle::MessageType, const char*, size_t));
96 MOCK_METHOD1(FlowControl, void(int64_t)); 96 MOCK_METHOD1(FlowControl, void(int64_t));
97 MOCK_METHOD2(Close, void(unsigned short, const String&)); 97 MOCK_METHOD2(Close, void(unsigned short, const String&));
98 }; 98 };
99 99
100 class MockWebSocketHandshakeThrottle : public WebSocketHandshakeThrottle { 100 class MockWebSocketHandshakeThrottle : public WebSocketHandshakeThrottle {
101 public: 101 public:
102 static MockWebSocketHandshakeThrottle* Create() { 102 static MockWebSocketHandshakeThrottle* Create() {
103 return new testing::StrictMock<MockWebSocketHandshakeThrottle>(); 103 return new ::testing::StrictMock<MockWebSocketHandshakeThrottle>();
104 } 104 }
105 MockWebSocketHandshakeThrottle() {} 105 MockWebSocketHandshakeThrottle() {}
106 ~MockWebSocketHandshakeThrottle() override { Destructor(); } 106 ~MockWebSocketHandshakeThrottle() override { Destructor(); }
107 107
108 MOCK_METHOD3(ThrottleHandshake, 108 MOCK_METHOD3(ThrottleHandshake,
109 void(const WebURL&, 109 void(const WebURL&,
110 WebLocalFrame*, 110 WebLocalFrame*,
111 WebCallbacks<void, const WebString&>*)); 111 WebCallbacks<void, const WebString&>*));
112 112
113 // This method is used to allow us to require that the destructor is called at 113 // This method is used to allow us to require that the destructor is called at
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 } 1022 }
1023 Channel()->Connect(url(), ""); 1023 Channel()->Connect(url(), "");
1024 HandleClient()->DidClose(Handle(), false, 1024 HandleClient()->DidClose(Handle(), false,
1025 WebSocketChannel::kCloseEventCodeProtocolError, 1025 WebSocketChannel::kCloseEventCodeProtocolError,
1026 "connect error"); 1026 "connect error");
1027 } 1027 }
1028 1028
1029 } // namespace 1029 } // namespace
1030 1030
1031 } // namespace blink 1031 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp ('k') | third_party/WebKit/Source/platform/PODArenaTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698