OLD | NEW |
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 #include "modules/websockets/DOMWebSocket.h" | 6 #include "modules/websockets/DOMWebSocket.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
10 #include "core/dom/DOMTypedArray.h" | 10 #include "core/dom/DOMTypedArray.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 using testing::_; | 24 using testing::_; |
25 using testing::AnyNumber; | 25 using testing::AnyNumber; |
26 using testing::InSequence; | 26 using testing::InSequence; |
27 using testing::Ref; | 27 using testing::Ref; |
28 using testing::Return; | 28 using testing::Return; |
29 | 29 |
30 namespace blink { | 30 namespace blink { |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 typedef testing::StrictMock<testing::MockFunction<void(int)> > Checkpoint; // N
OLINT | 34 typedef testing::StrictMock<testing::MockFunction<void(int)>> Checkpoint; // NO
LINT |
35 | 35 |
36 class MockWebSocketChannel : public WebSocketChannel { | 36 class MockWebSocketChannel : public WebSocketChannel { |
37 public: | 37 public: |
38 static MockWebSocketChannel* create() | 38 static MockWebSocketChannel* create() |
39 { | 39 { |
40 return new testing::StrictMock<MockWebSocketChannel>(); | 40 return new testing::StrictMock<MockWebSocketChannel>(); |
41 } | 41 } |
42 | 42 |
43 virtual ~MockWebSocketChannel() | 43 virtual ~MockWebSocketChannel() |
44 { | 44 { |
45 } | 45 } |
46 | 46 |
47 MOCK_METHOD2(connect, bool(const KURL&, const String&)); | 47 MOCK_METHOD2(connect, bool(const KURL&, const String&)); |
48 MOCK_METHOD1(send, void(const String&)); | 48 MOCK_METHOD1(send, void(const String&)); |
49 MOCK_METHOD3(send, void(const DOMArrayBuffer&, unsigned, unsigned)); | 49 MOCK_METHOD3(send, void(const DOMArrayBuffer&, unsigned, unsigned)); |
50 MOCK_METHOD1(send, void(PassRefPtr<BlobDataHandle>)); | 50 MOCK_METHOD1(send, void(PassRefPtr<BlobDataHandle>)); |
51 MOCK_METHOD1(send, void(PassOwnPtr<Vector<char> >)); | 51 MOCK_METHOD1(send, void(PassOwnPtr<Vector<char>>)); |
52 MOCK_CONST_METHOD0(bufferedAmount, unsigned()); | 52 MOCK_CONST_METHOD0(bufferedAmount, unsigned()); |
53 MOCK_METHOD2(close, void(int, const String&)); | 53 MOCK_METHOD2(close, void(int, const String&)); |
54 MOCK_METHOD4(fail, void(const String&, MessageLevel, const String&, unsigned
)); | 54 MOCK_METHOD4(fail, void(const String&, MessageLevel, const String&, unsigned
)); |
55 MOCK_METHOD0(disconnect, void()); | 55 MOCK_METHOD0(disconnect, void()); |
56 | 56 |
57 MockWebSocketChannel() | 57 MockWebSocketChannel() |
58 { | 58 { |
59 } | 59 } |
60 }; | 60 }; |
61 | 61 |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 EXPECT_EQ(InvalidAccessError, m_exceptionState.code()); | 697 EXPECT_EQ(InvalidAccessError, m_exceptionState.code()); |
698 EXPECT_EQ(String::format("The code must be either 1000, or between 3000 and
4999. %d is neither.", GetParam()), m_exceptionState.message()); | 698 EXPECT_EQ(String::format("The code must be either 1000, or between 3000 and
4999. %d is neither.", GetParam()), m_exceptionState.message()); |
699 EXPECT_EQ(DOMWebSocket::CONNECTING, m_websocket->readyState()); | 699 EXPECT_EQ(DOMWebSocket::CONNECTING, m_websocket->readyState()); |
700 } | 700 } |
701 | 701 |
702 INSTANTIATE_TEST_CASE_P(DOMWebSocketInvalidClosingCode, DOMWebSocketInvalidClosi
ngCodeTest, ::testing::Values(0, 1, 998, 999, 1001, 2999, 5000, 9999, 65535)); | 702 INSTANTIATE_TEST_CASE_P(DOMWebSocketInvalidClosingCode, DOMWebSocketInvalidClosi
ngCodeTest, ::testing::Values(0, 1, 998, 999, 1001, 2999, 5000, 9999, 65535)); |
703 | 703 |
704 } // namespace | 704 } // namespace |
705 | 705 |
706 } // namespace blink | 706 } // namespace blink |
OLD | NEW |