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

Side by Side Diff: chrome/worker/worker_uitest.cc

Issue 395006: Turn on shared workers by default (remove --enable-shared-workers, replace with (Closed)
Patch Set: Created 11 years, 1 month 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 | « chrome/renderer/renderer_webkitclient_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/string_util.h" 5 #include "base/string_util.h"
6 #include "chrome/browser/worker_host/worker_service.h" 6 #include "chrome/browser/worker_host/worker_service.h"
7 #include "chrome/common/chrome_switches.h" 7 #include "chrome/common/chrome_switches.h"
8 #include "chrome/test/automation/browser_proxy.h" 8 #include "chrome/test/automation/browser_proxy.h"
9 #include "chrome/test/automation/tab_proxy.h" 9 #include "chrome/test/automation/tab_proxy.h"
10 #include "chrome/test/ui/ui_layout_test.h" 10 #include "chrome/test/ui/ui_layout_test.h"
11 11
12 static const char kTestCompleteCookie[] = "status"; 12 static const char kTestCompleteCookie[] = "status";
13 static const char kTestCompleteSuccess[] = "OK"; 13 static const char kTestCompleteSuccess[] = "OK";
14 14
15 class WorkerTest : public UILayoutTest { 15 class WorkerTest : public UILayoutTest {
16 protected: 16 protected:
17 virtual ~WorkerTest() { } 17 virtual ~WorkerTest() { }
18 18
19 virtual void SetUp() {
20 launch_arguments_.AppendSwitch(switches::kEnableSharedWorkers);
21 UILayoutTest::SetUp();
22 }
23
24 void RunTest(const std::wstring& test_case) { 19 void RunTest(const std::wstring& test_case) {
25 scoped_refptr<TabProxy> tab(GetActiveTab()); 20 scoped_refptr<TabProxy> tab(GetActiveTab());
26 ASSERT_TRUE(tab.get()); 21 ASSERT_TRUE(tab.get());
27 22
28 GURL url = GetTestUrl(L"workers", test_case); 23 GURL url = GetTestUrl(L"workers", test_case);
29 ASSERT_TRUE(tab->NavigateToURL(url)); 24 ASSERT_TRUE(tab->NavigateToURL(url));
30 25
31 std::string value = WaitUntilCookieNonEmpty(tab.get(), url, 26 std::string value = WaitUntilCookieNonEmpty(tab.get(), url,
32 kTestCompleteCookie, kTestIntervalMs, kTestWaitTimeoutMs); 27 kTestCompleteCookie, kTestIntervalMs, kTestWaitTimeoutMs);
33 ASSERT_STREQ(kTestCompleteSuccess, value.c_str()); 28 ASSERT_STREQ(kTestCompleteSuccess, value.c_str());
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 FilePath resource_dir; 152 FilePath resource_dir;
158 resource_dir = resource_dir.AppendASCII("resources"); 153 resource_dir = resource_dir.AppendASCII("resources");
159 AddResourceForLayoutTest(js_dir, resource_dir); 154 AddResourceForLayoutTest(js_dir, resource_dir);
160 155
161 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i) 156 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i)
162 RunLayoutTest(kLayoutTestFiles[i], false); 157 RunLayoutTest(kLayoutTestFiles[i], false);
163 } 158 }
164 159
165 TEST_F(WorkerTest, WorkerHttpLayoutTests) { 160 TEST_F(WorkerTest, WorkerHttpLayoutTests) {
166 static const char* kLayoutTestFiles[] = { 161 static const char* kLayoutTestFiles[] = {
167 // Enable when shared workers are working (http://crbug.com/26899)
168 "shared-worker-importScripts.html", 162 "shared-worker-importScripts.html",
169 "shared-worker-redirect.html", 163 "shared-worker-redirect.html",
170 // flakey? BUG 16934 "text-encoding.html", 164 // flakey? BUG 16934 "text-encoding.html",
171 #if defined(OS_WIN) 165 #if defined(OS_WIN)
172 // Fails on the mac (and linux?): 166 // Fails on the mac (and linux?):
173 // http://code.google.com/p/chromium/issues/detail?id=22599 167 // http://code.google.com/p/chromium/issues/detail?id=22599
174 "worker-importScripts.html", 168 "worker-importScripts.html",
175 #endif 169 #endif
176 "worker-redirect.html", 170 "worker-redirect.html",
177 }; 171 };
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 window->AppendTab(url); 294 window->AppendTab(url);
301 295
302 // Check that we didn't create more than the max number of workers. 296 // Check that we didn't create more than the max number of workers.
303 ASSERT_TRUE(WaitForProcessCountToBe(tab_count, total_workers)); 297 ASSERT_TRUE(WaitForProcessCountToBe(tab_count, total_workers));
304 298
305 // Now close a page and check that the queued workers were started. 299 // Now close a page and check that the queued workers were started.
306 tab->NavigateToURL(GetTestUrl(L"google", L"google.html")); 300 tab->NavigateToURL(GetTestUrl(L"google", L"google.html"));
307 301
308 ASSERT_TRUE(WaitForProcessCountToBe(tab_count, total_workers)); 302 ASSERT_TRUE(WaitForProcessCountToBe(tab_count, total_workers));
309 } 303 }
OLDNEW
« no previous file with comments | « chrome/renderer/renderer_webkitclient_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698