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

Side by Side Diff: Source/modules/websockets/DOMWebSocketTest.cpp

Issue 614373007: Oilpan: Remove adoptRefCountedGarbageCollected (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
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 "config.h" 5 #include "config.h"
6 6
7 #include "modules/websockets/DOMWebSocket.h" 7 #include "modules/websockets/DOMWebSocket.h"
8 8
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/V8Binding.h" 10 #include "bindings/core/v8/V8Binding.h"
(...skipping 21 matching lines...) Expand all
32 namespace blink { 32 namespace blink {
33 33
34 namespace { 34 namespace {
35 35
36 typedef testing::StrictMock<testing::MockFunction<void(int)> > Checkpoint; // N OLINT 36 typedef testing::StrictMock<testing::MockFunction<void(int)> > Checkpoint; // N OLINT
37 37
38 class MockWebSocketChannel : public WebSocketChannel { 38 class MockWebSocketChannel : public WebSocketChannel {
39 public: 39 public:
40 static MockWebSocketChannel* create() 40 static MockWebSocketChannel* create()
41 { 41 {
42 return adoptRefCountedGarbageCollected(new testing::StrictMock<MockWebSo cketChannel>()); 42 return new testing::StrictMock<MockWebSocketChannel>();
43 } 43 }
44 44
45 virtual ~MockWebSocketChannel() 45 virtual ~MockWebSocketChannel()
46 { 46 {
47 } 47 }
48 48
49 MOCK_METHOD2(connect, bool(const KURL&, const String&)); 49 MOCK_METHOD2(connect, bool(const KURL&, const String&));
50 MOCK_METHOD1(send, void(const String&)); 50 MOCK_METHOD1(send, void(const String&));
51 MOCK_METHOD3(send, void(const ArrayBuffer&, unsigned, unsigned)); 51 MOCK_METHOD3(send, void(const ArrayBuffer&, unsigned, unsigned));
52 MOCK_METHOD1(send, void(PassRefPtr<BlobDataHandle>)); 52 MOCK_METHOD1(send, void(PassRefPtr<BlobDataHandle>));
53 MOCK_METHOD1(send, void(PassOwnPtr<Vector<char> >)); 53 MOCK_METHOD1(send, void(PassOwnPtr<Vector<char> >));
54 MOCK_CONST_METHOD0(bufferedAmount, unsigned long()); 54 MOCK_CONST_METHOD0(bufferedAmount, unsigned long());
55 MOCK_METHOD2(close, void(int, const String&)); 55 MOCK_METHOD2(close, void(int, const String&));
56 MOCK_METHOD4(fail, void(const String&, MessageLevel, const String&, unsigned )); 56 MOCK_METHOD4(fail, void(const String&, MessageLevel, const String&, unsigned ));
57 MOCK_METHOD0(disconnect, void()); 57 MOCK_METHOD0(disconnect, void());
58 MOCK_METHOD0(suspend, void()); 58 MOCK_METHOD0(suspend, void());
59 MOCK_METHOD0(resume, void()); 59 MOCK_METHOD0(resume, void());
60 60
61 MockWebSocketChannel() 61 MockWebSocketChannel()
62 { 62 {
63 } 63 }
64 }; 64 };
65 65
66 class DOMWebSocketWithMockChannel final : public DOMWebSocket { 66 class DOMWebSocketWithMockChannel final : public DOMWebSocket {
67 public: 67 public:
68 static DOMWebSocketWithMockChannel* create(ExecutionContext* context) 68 static DOMWebSocketWithMockChannel* create(ExecutionContext* context)
69 { 69 {
70 DOMWebSocketWithMockChannel* websocket = adoptRefCountedGarbageCollected WillBeNoop(new DOMWebSocketWithMockChannel(context)); 70 DOMWebSocketWithMockChannel* websocket = new DOMWebSocketWithMockChannel (context);
71 websocket->suspendIfNeeded(); 71 websocket->suspendIfNeeded();
72 return websocket; 72 return websocket;
73 } 73 }
74 74
75 MockWebSocketChannel* channel() { return m_channel.get(); } 75 MockWebSocketChannel* channel() { return m_channel.get(); }
76 76
77 virtual WebSocketChannel* createChannel(ExecutionContext*, WebSocketChannelC lient*) override 77 virtual WebSocketChannel* createChannel(ExecutionContext*, WebSocketChannelC lient*) override
78 { 78 {
79 ASSERT(!m_hasCreatedChannel); 79 ASSERT(!m_hasCreatedChannel);
80 m_hasCreatedChannel = true; 80 m_hasCreatedChannel = true;
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 EXPECT_EQ(InvalidAccessError, m_exceptionState.code()); 701 EXPECT_EQ(InvalidAccessError, m_exceptionState.code());
702 EXPECT_EQ(String::format("The code must be either 1000, or between 3000 and 4999. %d is neither.", GetParam()), m_exceptionState.message()); 702 EXPECT_EQ(String::format("The code must be either 1000, or between 3000 and 4999. %d is neither.", GetParam()), m_exceptionState.message());
703 EXPECT_EQ(DOMWebSocket::CONNECTING, m_websocket->readyState()); 703 EXPECT_EQ(DOMWebSocket::CONNECTING, m_websocket->readyState());
704 } 704 }
705 705
706 INSTANTIATE_TEST_CASE_P(DOMWebSocketInvalidClosingCode, DOMWebSocketInvalidClosi ngCodeTest, ::testing::Values(0, 1, 998, 999, 1001, 2999, 5000, 9999, 65535)); 706 INSTANTIATE_TEST_CASE_P(DOMWebSocketInvalidClosingCode, DOMWebSocketInvalidClosi ngCodeTest, ::testing::Values(0, 1, 998, 999, 1001, 2999, 5000, 9999, 65535));
707 707
708 } // namespace 708 } // namespace
709 709
710 } // namespace blink 710 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/websockets/DOMWebSocket.cpp ('k') | Source/modules/websockets/MainThreadWebSocketChannel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698