summaryrefslogtreecommitdiffstats
path: root/content/browser/worker_host
diff options
context:
space:
mode:
authortoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-17 08:35:00 +0000
committertoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-17 08:35:00 +0000
commitca6966bf908defc280bef151c6964a4fc1429708 (patch)
treef2424ffe6815884676cdb426dac4de295ff26bd9 /content/browser/worker_host
parent3f58551be28a5a2084503112251bcfafb7fcbdd9 (diff)
downloadchromium_src-ca6966bf908defc280bef151c6964a4fc1429708.zip
chromium_src-ca6966bf908defc280bef151c6964a4fc1429708.tar.gz
chromium_src-ca6966bf908defc280bef151c6964a4fc1429708.tar.bz2
Replace WorkerWebSocketHttpLayoutTest with WorkerTest.WebSocketSharedWorker.
WorkerWebSocketHttpLayoutTest was disable. Actually, shared-worker-simple.html is the only test which is useful to run now. Also, providing fixed port for WebSocket test server is not so easy. So, I decided to remove existing WorkerWebSocketHttpLayoutTest, then introduce WorkerTest.WebSocketSharedWorker as a compatible test with shared-worker-simple.html. BUG=155014, 137639 TEST=content_browsertests --gtest_filter='WorkerTest.WebSocketSharedWorker' Review URL: https://chromiumcodereview.appspot.com/11028111 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162326 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/worker_host')
-rw-r--r--content/browser/worker_host/test/worker_browsertest.cc55
1 files changed, 24 insertions, 31 deletions
diff --git a/content/browser/worker_host/test/worker_browsertest.cc b/content/browser/worker_host/test/worker_browsertest.cc
index 1e1913e..c37a187 100644
--- a/content/browser/worker_host/test/worker_browsertest.cc
+++ b/content/browser/worker_host/test/worker_browsertest.cc
@@ -23,6 +23,7 @@
#include "content/test/content_browser_test_utils.h"
#include "content/test/layout_browsertest.h"
#include "googleurl/src/gurl.h"
+#include "net/test/test_server.h"
using content::BrowserThread;
using content::WorkerServiceImpl;
@@ -221,37 +222,6 @@ IN_PROC_BROWSER_TEST_F(WorkerXHRHttpLayoutTest, Tests) {
RunHttpLayoutTest(kLayoutTestFiles[i]);
}
-class WorkerWebSocketHttpLayoutTest : public InProcessBrowserLayoutTest {
- public:
- WorkerWebSocketHttpLayoutTest() : InProcessBrowserLayoutTest(
- FilePath(),
- FilePath().AppendASCII("http").AppendASCII("tests").
- AppendASCII("websocket").AppendASCII("tests").AppendASCII("hybi").
- AppendASCII("workers"),
- -1) {
- }
-};
-
-IN_PROC_BROWSER_TEST_F(WorkerWebSocketHttpLayoutTest, DISABLED_Tests) {
- static const char* kLayoutTestFiles[] = {
- "close-in-onmessage-crash.html",
- "close-in-shared-worker.html",
- "close-in-worker.html",
- "shared-worker-simple.html",
- "worker-handshake-challenge-randomness.html",
- "worker-simple.html"
- };
-
- FilePath websocket_test_dir;
- ASSERT_TRUE(PathService::Get(content::DIR_LAYOUT_TESTS, &websocket_test_dir));
-
- content::TestWebSocketServer websocket_server;
- ASSERT_TRUE(websocket_server.Start(websocket_test_dir));
-
- for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i)
- RunHttpLayoutTest(kLayoutTestFiles[i]);
-}
-
class WorkerTest : public content::ContentBrowserTest {
public:
WorkerTest() {}
@@ -480,3 +450,26 @@ IN_PROC_BROWSER_TEST_F(WorkerTest, DISABLED_QueuedSharedWorkerStartedFromOtherTa
ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab + 1));
}
+
+IN_PROC_BROWSER_TEST_F(WorkerTest, WebSocketSharedWorker) {
+ // Launch WebSocket server.
+ net::TestServer ws_server(net::TestServer::TYPE_WS,
+ net::TestServer::kLocalhost,
+ FilePath(FILE_PATH_LITERAL("net/data/websocket")));
+ ASSERT_TRUE(ws_server.Start());
+
+ // Generate test URL.
+ std::string scheme("http");
+ GURL::Replacements replacements;
+ replacements.SetSchemeStr(scheme);
+ GURL url = ws_server.GetURL(
+ "websocket_shared_worker.html").ReplaceComponents(replacements);
+
+ // Run test.
+ content::Shell* window = shell();
+ const string16 expected_title = ASCIIToUTF16("OK");
+ content::TitleWatcher title_watcher(window->web_contents(), expected_title);
+ content::NavigateToURL(window, url);
+ string16 final_title = title_watcher.WaitAndGetTitle();
+ EXPECT_EQ(expected_title, final_title);
+}