OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 10 matching lines...) Expand all Loading... |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "public/web/WebSelector.h" | 31 #include "public/platform/modules/websockets/WebSocketHandshakeResponseInfo.h" |
32 | 32 |
| 33 #include "platform/network/WebSocketHandshakeResponse.h" |
33 #include "public/platform/WebString.h" | 34 #include "public/platform/WebString.h" |
34 #include "testing/gtest/include/gtest/gtest.h" | |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 TEST(WebSelectorTest, Canonicalizes) | 38 WebSocketHandshakeResponseInfo::WebSocketHandshakeResponseInfo() : m_private(new
WebSocketHandshakeResponse) |
39 { | 39 { |
40 EXPECT_EQ("h1, h2[style=\"foobar\"] span", canonicalizeSelector("h1,h2[style
='foobar'] span").utf8()); | |
41 EXPECT_EQ("h1, h2[style=\"foobar\"] span", canonicalizeSelector("h1, h2[styl
e=\"foobar\"] span").utf8()); | |
42 } | 40 } |
43 | 41 |
44 TEST(WebSelectorTest, Checks) | 42 WebSocketHandshakeResponseInfo::~WebSocketHandshakeResponseInfo() |
45 { | 43 { |
46 EXPECT_EQ("", canonicalizeSelector("h1..h2").utf8()); | |
47 EXPECT_EQ("", canonicalizeSelector("h1..h2", WebSelectorTypeCompound).utf8()
); | |
48 } | 44 } |
49 | 45 |
50 TEST(WebSelectorTest, Restricts) | 46 void WebSocketHandshakeResponseInfo::setStatusCode(int statusCode) |
51 { | 47 { |
52 EXPECT_EQ("", canonicalizeSelector("h1 span,h2", WebSelectorTypeCompound).ut
f8()); | 48 m_private->setStatusCode(statusCode); |
53 EXPECT_EQ("h1, h2[style=\"foobar\"].cls", canonicalizeSelector("h1,h2[style=
\"foobar\"].cls", WebSelectorTypeCompound).utf8()); | 49 } |
| 50 |
| 51 void WebSocketHandshakeResponseInfo::setStatusText(const WebString& statusText) |
| 52 { |
| 53 m_private->setStatusText(statusText); |
| 54 } |
| 55 |
| 56 void WebSocketHandshakeResponseInfo::addHeaderField(const WebString& name, const
WebString& value) |
| 57 { |
| 58 m_private->addHeaderField(name, value); |
| 59 } |
| 60 |
| 61 void WebSocketHandshakeResponseInfo::setHeadersText(const WebString& text) |
| 62 { |
| 63 m_private->setHeadersText(text); |
54 } | 64 } |
55 | 65 |
56 } // namespace blink | 66 } // namespace blink |
OLD | NEW |