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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | net/data/websocket/README » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/websocket_browsertest.cc
diff --git a/chrome/browser/net/websocket_browsertest.cc b/chrome/browser/net/websocket_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7e0dcc7b669e2ff5aa72fea30a9caee22485c964
--- /dev/null
+++ b/chrome/browser/net/websocket_browsertest.cc
@@ -0,0 +1,94 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_tabstrip.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "chrome/test/base/ui_test_utils.h"
+#include "content/public/test/browser_test_utils.h"
+#include "net/base/test_data_directory.h"
+#include "net/test/test_server.h"
+
+namespace {
+
+class WebSocketBrowserTest : public InProcessBrowserTest {
+ public:
+ WebSocketBrowserTest()
+ : ws_server_(net::TestServer::TYPE_WS,
+ net::TestServer::kLocalhost,
+ net::GetWebSocketTestDataDirectory()),
+ wss_server_(net::TestServer::TYPE_WSS,
+ SSLOptions(SSLOptions::CERT_OK),
+ net::GetWebSocketTestDataDirectory()) {
+ }
+
+ protected:
+ net::TestServer ws_server_;
+ net::TestServer wss_server_;
+
+ private:
+ typedef net::TestServer::SSLOptions SSLOptions;
+
+ DISALLOW_COPY_AND_ASSIGN(WebSocketBrowserTest);
+};
+
+// Test that the browser can handle a WebSocket frame split into multiple TCP
+// packets.
+IN_PROC_BROWSER_TEST_F(WebSocketBrowserTest, SplitWebSocketFrame) {
+ // Launch a WebSocket server.
+ ASSERT_TRUE(ws_server_.Start());
+
+ // Setup page title observer.
+ content::WebContents* tab = chrome::GetActiveWebContents(browser());
+ content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS"));
+ watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
+
+ // Visit a HTTP page for testing.
+ std::string scheme("http");
+ GURL::Replacements replacements;
+ replacements.SetSchemeStr(scheme);
+ ui_test_utils::NavigateToURL(
+ browser(),
+ ws_server_.GetURL(
+ "split_frame_check.html").ReplaceComponents(replacements));
+
+ const string16 result = watcher.WaitAndGetTitle();
+ EXPECT_TRUE(EqualsASCII(result, "PASS"));
+}
+
+#if defined(USE_OPENSSL)
+// TODO(toyoshim): Fix the issue on OpenSSL
+#define MAYBE_SplitSecureWebSocketFrame DISABLED_SplitSecureWebSocketFrame
+#else
+#define MAYBE_SplitSecureWebSocketFrame SplitSecureWebSocketFrame
+#endif
+// Test that the browser can handle a WebSocket frame split into multiple TCP
+// packets or SSL records.
+IN_PROC_BROWSER_TEST_F(WebSocketBrowserTest, MAYBE_SplitSecureWebSocketFrame) {
+ // Launch a secure WebSocket server.
+ ASSERT_TRUE(wss_server_.Start());
+
+ // Setup page title observer.
+ content::WebContents* tab = chrome::GetActiveWebContents(browser());
+ content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS"));
+ watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
+
+ // Visit a HTTPS page for testing.
+ std::string scheme("https");
+ GURL::Replacements replacements;
+ replacements.SetSchemeStr(scheme);
+ ui_test_utils::NavigateToURL(
+ browser(),
+ wss_server_.GetURL(
+ "split_frame_check.html").ReplaceComponents(replacements));
+
+ const string16 result = watcher.WaitAndGetTitle();
+ EXPECT_TRUE(EqualsASCII(result, "PASS"));
+}
+
+// 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
+
+} // namespace
« 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