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

Side by Side Diff: chrome/browser/net/websocket_browsertest.cc

Issue 11366155: SSLClientSocket::IsConnected should care for internal buffers (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: remove comments Created 7 years, 11 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
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | net/data/websocket/README » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/string_util.h"
6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_tabstrip.h"
9 #include "chrome/test/base/in_process_browser_test.h"
10 #include "chrome/test/base/ui_test_utils.h"
11 #include "content/public/test/browser_test_utils.h"
12 #include "net/base/test_data_directory.h"
13 #include "net/test/test_server.h"
14
15 namespace {
16
17 class WebSocketBrowserTest : public InProcessBrowserTest {
18 public:
19 WebSocketBrowserTest()
20 : ws_server_(net::TestServer::TYPE_WS,
21 net::TestServer::kLocalhost,
22 net::GetWebSocketTestDataDirectory()),
23 wss_server_(net::TestServer::TYPE_WSS,
24 SSLOptions(SSLOptions::CERT_OK),
25 net::GetWebSocketTestDataDirectory()) {
26 }
27
28 protected:
29 net::TestServer ws_server_;
30 net::TestServer wss_server_;
31
32 private:
33 typedef net::TestServer::SSLOptions SSLOptions;
34
35 DISALLOW_COPY_AND_ASSIGN(WebSocketBrowserTest);
36 };
37
38 // Test that the browser can handle a WebSocket frame split into multiple TCP
39 // segments.
40 IN_PROC_BROWSER_TEST_F(WebSocketBrowserTest, WebSocketSplitSegments) {
41 // Launch a WebSocket server.
42 ASSERT_TRUE(ws_server_.Start());
43
44 // Setup page title observer.
45 content::WebContents* tab = chrome::GetActiveWebContents(browser());
46 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS"));
47 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
48
49 // Visit a HTTP page for testing.
50 std::string scheme("http");
51 GURL::Replacements replacements;
52 replacements.SetSchemeStr(scheme);
53 ui_test_utils::NavigateToURL(
54 browser(),
55 ws_server_.GetURL(
56 "split_packet_check.html").ReplaceComponents(replacements));
57
58 const string16 result = watcher.WaitAndGetTitle();
59 EXPECT_TRUE(EqualsASCII(result, "PASS"));
60 }
61
62 #if defined(USE_OPENSSL)
63 // TODO(toyoshim): Enable this test for OpenSSL once http://crbug.com/160033
64 // is fixed against OpenSSL.
65 #define MAYBE_SecureWebSocketSplitRecords DISABLED_SecureWebSocketSplitRecords
66 #else
67 #define MAYBE_SecureWebSocketSplitRecords SecureWebSocketSplitRecords
68 #endif
69 // Test that the browser can handle a WebSocket frame split into multiple SSL
70 // records.
71 IN_PROC_BROWSER_TEST_F(WebSocketBrowserTest,
72 MAYBE_SecureWebSocketSplitRecords) {
73 // Launch a secure WebSocket server.
74 ASSERT_TRUE(wss_server_.Start());
75
76 // Setup page title observer.
77 content::WebContents* tab = chrome::GetActiveWebContents(browser());
78 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS"));
79 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
80
81 // Visit a HTTPS page for testing.
82 std::string scheme("https");
83 GURL::Replacements replacements;
84 replacements.SetSchemeStr(scheme);
85 ui_test_utils::NavigateToURL(
86 browser(),
87 wss_server_.GetURL(
88 "split_packet_check.html").ReplaceComponents(replacements));
89
90 const string16 result = watcher.WaitAndGetTitle();
91 EXPECT_TRUE(EqualsASCII(result, "PASS"));
92 }
93
94 // TODO(toyoshim): Add the same test by using --use-system-ssl for system
95 // libraries on Win and Mac once http://crbug.com/160033 is fixed against them.
wtc 2013/01/16 00:34:16 Delete this comment. We are going to remove the --
Takashi Toyoshima 2013/01/16 07:16:03 Oh, I see. Done!
96
97 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | net/data/websocket/README » ('J')

Powered by Google App Engine
This is Rietveld 408576698