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

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: Split _win fix to another CL 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 // packets.
40 IN_PROC_BROWSER_TEST_F(WebSocketBrowserTest, SplitWebSocketFrame) {
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_frame_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): Fix the issue on OpenSSL
64 #define MAYBE_SplitSecureWebSocketFrame DISABLED_SplitSecureWebSocketFrame
65 #else
66 #define MAYBE_SplitSecureWebSocketFrame SplitSecureWebSocketFrame
67 #endif
68 // Test that the browser can handle a WebSocket frame split into multiple TCP
69 // packets or SSL records.
70 IN_PROC_BROWSER_TEST_F(WebSocketBrowserTest, MAYBE_SplitSecureWebSocketFrame) {
71 // Launch a secure WebSocket server.
72 ASSERT_TRUE(wss_server_.Start());
73
74 // Setup page title observer.
75 content::WebContents* tab = chrome::GetActiveWebContents(browser());
76 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS"));
77 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
78
79 // Visit a HTTPS page for testing.
80 std::string scheme("https");
81 GURL::Replacements replacements;
82 replacements.SetSchemeStr(scheme);
83 ui_test_utils::NavigateToURL(
84 browser(),
85 wss_server_.GetURL(
86 "split_frame_check.html").ReplaceComponents(replacements));
87
88 const string16 result = watcher.WaitAndGetTitle();
89 EXPECT_TRUE(EqualsASCII(result, "PASS"));
90 }
91
92 // TODO(toyoshim): Add test for --use-system-ssl and fix issues on Win and Mac.
wtc 2013/01/14 20:50:08 I think you can ignore the --use-system-ssl code.
Takashi Toyoshima 2013/01/15 13:46:03 This is a TODO for fixing the same bug on system l
93
94 } // 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