| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  212     } |  212     } | 
|  213  |  213  | 
|  214     m_pageHolder->document().setInsecureContentPolicy(SecurityContext::InsecureC
     ontentDoNotUpgrade); |  214     m_pageHolder->document().setInsecureContentPolicy(SecurityContext::InsecureC
     ontentDoNotUpgrade); | 
|  215     m_websocket->connect("ws://example.com/endpoint", Vector<String>(), m_except
     ionState); |  215     m_websocket->connect("ws://example.com/endpoint", Vector<String>(), m_except
     ionState); | 
|  216  |  216  | 
|  217     EXPECT_FALSE(m_exceptionState.hadException()); |  217     EXPECT_FALSE(m_exceptionState.hadException()); | 
|  218     EXPECT_EQ(DOMWebSocket::CONNECTING, m_websocket->readyState()); |  218     EXPECT_EQ(DOMWebSocket::CONNECTING, m_websocket->readyState()); | 
|  219     EXPECT_EQ(KURL(KURL(), "ws://example.com/endpoint"), m_websocket->url()); |  219     EXPECT_EQ(KURL(KURL(), "ws://example.com/endpoint"), m_websocket->url()); | 
|  220 } |  220 } | 
|  221  |  221  | 
|  222 TEST_F(DOMWebSocketTest, insecureContentMonitor) |  | 
|  223 { |  | 
|  224     { |  | 
|  225         InSequence s; |  | 
|  226         EXPECT_CALL(channel(), connect(KURL(KURL(), "ws://example.com/endpoint")
     , String())).WillOnce(Return(true)); |  | 
|  227     } |  | 
|  228  |  | 
|  229     m_pageHolder->document().setInsecureContentPolicy(SecurityContext::InsecureC
     ontentMonitor); |  | 
|  230     m_websocket->connect("ws://example.com/endpoint", Vector<String>(), m_except
     ionState); |  | 
|  231  |  | 
|  232     EXPECT_FALSE(m_exceptionState.hadException()); |  | 
|  233     EXPECT_EQ(DOMWebSocket::CONNECTING, m_websocket->readyState()); |  | 
|  234     EXPECT_EQ(KURL(KURL(), "ws://example.com/endpoint"), m_websocket->url()); |  | 
|  235 } |  | 
|  236  |  | 
|  237 TEST_F(DOMWebSocketTest, channelConnectSuccess) |  222 TEST_F(DOMWebSocketTest, channelConnectSuccess) | 
|  238 { |  223 { | 
|  239     Vector<String> subprotocols; |  224     Vector<String> subprotocols; | 
|  240     subprotocols.append("aa"); |  225     subprotocols.append("aa"); | 
|  241     subprotocols.append("bb"); |  226     subprotocols.append("bb"); | 
|  242  |  227  | 
|  243     { |  228     { | 
|  244         InSequence s; |  229         InSequence s; | 
|  245         EXPECT_CALL(channel(), connect(KURL(KURL(), "ws://example.com/hoge"), St
     ring("aa, bb"))).WillOnce(Return(true)); |  230         EXPECT_CALL(channel(), connect(KURL(KURL(), "ws://example.com/hoge"), St
     ring("aa, bb"))).WillOnce(Return(true)); | 
|  246     } |  231     } | 
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  744     EXPECT_EQ(InvalidAccessError, m_exceptionState.code()); |  729     EXPECT_EQ(InvalidAccessError, m_exceptionState.code()); | 
|  745     EXPECT_EQ(String::format("The code must be either 1000, or between 3000 and 
     4999. %d is neither.", GetParam()), m_exceptionState.message()); |  730     EXPECT_EQ(String::format("The code must be either 1000, or between 3000 and 
     4999. %d is neither.", GetParam()), m_exceptionState.message()); | 
|  746     EXPECT_EQ(DOMWebSocket::CONNECTING, m_websocket->readyState()); |  731     EXPECT_EQ(DOMWebSocket::CONNECTING, m_websocket->readyState()); | 
|  747 } |  732 } | 
|  748  |  733  | 
|  749 INSTANTIATE_TEST_CASE_P(DOMWebSocketInvalidClosingCode, DOMWebSocketInvalidClosi
     ngCodeTest, ::testing::Values(0, 1, 998, 999, 1001, 2999, 5000, 9999, 65535)); |  734 INSTANTIATE_TEST_CASE_P(DOMWebSocketInvalidClosingCode, DOMWebSocketInvalidClosi
     ngCodeTest, ::testing::Values(0, 1, 998, 999, 1001, 2999, 5000, 9999, 65535)); | 
|  750  |  735  | 
|  751 } // namespace |  736 } // namespace | 
|  752  |  737  | 
|  753 } // namespace blink |  738 } // namespace blink | 
| OLD | NEW |