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

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

Issue 490023: Enabled a number of worker tests on various platforms. (Closed)
Patch Set: Removed erroneous edit to websharedworker_stub.cc Created 11 years 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/test/data/workers/worker_utils.js ('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/app/chrome_dll_resource.h" 6 #include "chrome/app/chrome_dll_resource.h"
7 #include "chrome/browser/worker_host/worker_service.h" 7 #include "chrome/browser/worker_host/worker_service.h"
8 #include "chrome/common/chrome_switches.h" 8 #include "chrome/common/chrome_switches.h"
9 #include "chrome/test/automation/browser_proxy.h" 9 #include "chrome/test/automation/browser_proxy.h"
10 #include "chrome/test/automation/tab_proxy.h" 10 #include "chrome/test/automation/tab_proxy.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 PlatformThread::Sleep(sleep_timeout_ms() / 10); 71 PlatformThread::Sleep(sleep_timeout_ms() / 10);
72 } 72 }
73 73
74 EXPECT_EQ(number_of_processes, cur_process_count); 74 EXPECT_EQ(number_of_processes, cur_process_count);
75 return false; 75 return false;
76 } 76 }
77 }; 77 };
78 78
79 79
80 #if defined(OS_LINUX)
81 // Fails running under valgrind, http://crbug.com/28445
82 #define SingleWorker DISABLED_SingleWorker
83 #endif
84
85 TEST_F(WorkerTest, SingleWorker) { 80 TEST_F(WorkerTest, SingleWorker) {
86 RunTest(L"single_worker.html"); 81 RunTest(L"single_worker.html");
87 } 82 }
88 83
89 TEST_F(WorkerTest, MultipleWorkers) { 84 TEST_F(WorkerTest, MultipleWorkers) {
90 RunTest(L"multi_worker.html"); 85 RunTest(L"multi_worker.html");
91 } 86 }
92 87
88 TEST_F(WorkerTest, SingleSharedWorker) {
89 RunTest(L"single_worker.html?shared=true");
90 }
91
92 TEST_F(WorkerTest, MultipleSharedWorkers) {
93 RunTest(L"multi_worker.html?shared=true");
94 }
95
93 #if defined(OS_LINUX) 96 #if defined(OS_LINUX)
94 #define IncognitoSharedWorkers FLAKY_IncognitoSharedWorkers 97 #define IncognitoSharedWorkers FLAKY_IncognitoSharedWorkers
95 #endif 98 #endif
96 99
97 // Incognito windows should not share workers with non-incognito windows 100 // Incognito windows should not share workers with non-incognito windows
98 TEST_F(WorkerTest, IncognitoSharedWorkers) { 101 TEST_F(WorkerTest, IncognitoSharedWorkers) {
99 // Load a non-incognito tab and have it create a shared worker 102 // Load a non-incognito tab and have it create a shared worker
100 RunTest(L"incognito_worker.html"); 103 RunTest(L"incognito_worker.html");
101 // Incognito worker should not share with non-incognito 104 // Incognito worker should not share with non-incognito
102 RunIncognitoTest(L"incognito_worker.html"); 105 RunIncognitoTest(L"incognito_worker.html");
103 } 106 }
104 107
105 #if defined(OS_LINUX) || defined (OS_MACOSX) 108 #if defined(OS_LINUX) || defined (OS_MACOSX)
106 #define WorkerFastLayoutTests DISABLED_WorkerFastLayoutTests 109 #define WorkerFastLayoutTests FLAKY_WorkerFastLayoutTests
107 #endif 110 #endif
108 111
109 TEST_F(WorkerTest, WorkerFastLayoutTests) { 112 TEST_F(WorkerTest, WorkerFastLayoutTests) {
110 static const char* kLayoutTestFiles[] = { 113 static const char* kLayoutTestFiles[] = {
111 "stress-js-execution.html", 114 "stress-js-execution.html",
112 "use-machine-stack.html", 115 "use-machine-stack.html",
113 "worker-call.html", 116 "worker-call.html",
114 "worker-cloneport.html", 117 "worker-cloneport.html",
115 "worker-close.html", 118 "worker-close.html",
116 "worker-constructor.html", 119 "worker-constructor.html",
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // helps leaks trackers do a better job of reporting. 158 // helps leaks trackers do a better job of reporting.
156 scoped_refptr<TabProxy> tab(GetActiveTab()); 159 scoped_refptr<TabProxy> tab(GetActiveTab());
157 GURL about_url(std::string("file://localhost/")); 160 GURL about_url(std::string("file://localhost/"));
158 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(about_url)); 161 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(about_url));
159 } 162 }
160 163
161 #if defined(OS_WIN) || defined(OS_MACOSX) 164 #if defined(OS_WIN) || defined(OS_MACOSX)
162 // http://crbug.com/27636 - incorrect URL_MISMATCH exceptions sometimes get 165 // http://crbug.com/27636 - incorrect URL_MISMATCH exceptions sometimes get
163 // generated on the windows try bots. 166 // generated on the windows try bots.
164 // http://crbug.com/28445 - flakiness on mac 167 // http://crbug.com/28445 - flakiness on mac
165 #define SharedWorkerFastLayoutTests DISABLED_SharedWorkerFastLayoutTests 168 #define SharedWorkerFastLayoutTests FLAKY_SharedWorkerFastLayoutTests
166 #endif 169 #endif
167 170
168 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS) 171 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS)
169 // These tests are flaky on linux/views builds. 172 // These tests are flaky on linux/views builds.
170 // See http://crbug.com/28808. 173 // See http://crbug.com/28808.
171 #define MessagePorts FLAKY_MessagePorts 174 #define MessagePorts FLAKY_MessagePorts
172 #define SharedWorkerFastLayoutTests FLAKY_SharedWorkerFastLayoutTests 175 #define SharedWorkerFastLayoutTests FLAKY_SharedWorkerFastLayoutTests
173 #endif 176 #endif
174 177
175 TEST_F(WorkerTest, SharedWorkerFastLayoutTests) { 178 TEST_F(WorkerTest, SharedWorkerFastLayoutTests) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 FilePath worker_test_dir; 242 FilePath worker_test_dir;
240 worker_test_dir = worker_test_dir.AppendASCII("workers"); 243 worker_test_dir = worker_test_dir.AppendASCII("workers");
241 InitializeForLayoutTest(http_test_dir, worker_test_dir, true); 244 InitializeForLayoutTest(http_test_dir, worker_test_dir, true);
242 245
243 StartHttpServer(new_http_root_dir_); 246 StartHttpServer(new_http_root_dir_);
244 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i) 247 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i)
245 RunLayoutTest(kLayoutTestFiles[i], true); 248 RunLayoutTest(kLayoutTestFiles[i], true);
246 StopHttpServer(); 249 StopHttpServer();
247 } 250 }
248 251
249 #if defined(OS_LINUX)
250 // Fails running under valgrind http://crbug.com/28445
251 #define WorkerXhrHttpLayoutTests DISABLED_WorkerXhrHttpLayoutTests
252 #endif
253
254 TEST_F(WorkerTest, WorkerXhrHttpLayoutTests) { 252 TEST_F(WorkerTest, WorkerXhrHttpLayoutTests) {
255 static const char* kLayoutTestFiles[] = { 253 static const char* kLayoutTestFiles[] = {
256 "abort-exception-assert.html", 254 "abort-exception-assert.html",
257 #if defined(OS_WIN) 255 #if defined(OS_WIN)
258 // Fails on the mac (and linux?): 256 // Fails on the mac (and linux?):
259 // http://code.google.com/p/chromium/issues/detail?id=22599 257 // http://code.google.com/p/chromium/issues/detail?id=22599
260 "close.html", 258 "close.html",
261 #endif 259 #endif
262 // These tests (and the shared-worker versions below) are disabled due to 260 // These tests (and the shared-worker versions below) are disabled due to
263 // limitations in lighttpd (doesn't handle all of the HTTP methods). 261 // limitations in lighttpd (doesn't handle all of the HTTP methods).
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // MessagePort tests also rely on common files in js/resources. 317 // MessagePort tests also rely on common files in js/resources.
320 FilePath js_dir = fast_test_dir.AppendASCII("js"); 318 FilePath js_dir = fast_test_dir.AppendASCII("js");
321 FilePath resource_dir; 319 FilePath resource_dir;
322 resource_dir = resource_dir.AppendASCII("resources"); 320 resource_dir = resource_dir.AppendASCII("resources");
323 AddResourceForLayoutTest(js_dir, resource_dir); 321 AddResourceForLayoutTest(js_dir, resource_dir);
324 322
325 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i) 323 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i)
326 RunLayoutTest(kLayoutTestFiles[i], false); 324 RunLayoutTest(kLayoutTestFiles[i], false);
327 } 325 }
328 326
329 // Disable LimitPerPage on Linux. Seems to work on Mac though:
330 // http://code.google.com/p/chromium/issues/detail?id=22608
331 #if !defined(OS_LINUX)
332 // This test fails after WebKit merge 49414:49432. (BUG=24652)
333 TEST_F(WorkerTest, LimitPerPage) { 327 TEST_F(WorkerTest, LimitPerPage) {
334 int max_workers_per_tab = WorkerService::kMaxWorkersPerTabWhenSeparate; 328 int max_workers_per_tab = WorkerService::kMaxWorkersPerTabWhenSeparate;
335 GURL url = GetTestUrl(L"workers", L"many_workers.html"); 329 GURL url = GetTestUrl(L"workers", L"many_workers.html");
336 url = GURL(url.spec() + StringPrintf("?count=%d", max_workers_per_tab + 1)); 330 url = GURL(url.spec() + StringPrintf("?count=%d", max_workers_per_tab + 1));
337 331
338 scoped_refptr<TabProxy> tab(GetActiveTab()); 332 scoped_refptr<TabProxy> tab(GetActiveTab());
339 ASSERT_TRUE(tab.get()); 333 ASSERT_TRUE(tab.get());
340 ASSERT_TRUE(tab->NavigateToURL(url)); 334 ASSERT_TRUE(tab->NavigateToURL(url));
341 335
342 ASSERT_TRUE(WaitForProcessCountToBe(1, max_workers_per_tab)); 336 ASSERT_TRUE(WaitForProcessCountToBe(1, max_workers_per_tab));
343 } 337 }
344 #endif
345 338
346 #if defined(OS_LINUX) 339 #if defined(OS_LINUX) || defined(OS_MACOSX)
347 // Fails (crashes) on Linux Tests: http://crbug.com/28445
348 #define LimitTotal DISABLED_LimitTotal
349 #elif defined(OS_MACOSX)
350 // Doesn't crash, but on Mac it sometimes fails for a few runs in a row, 340 // Doesn't crash, but on Mac it sometimes fails for a few runs in a row,
351 // http://crbug.com/28445 341 // http://crbug.com/28445
352 #define LimitTotal FLAKY_LimitTotal 342 #define LimitTotal FLAKY_LimitTotal
353 #endif 343 #endif
354 344
355 TEST_F(WorkerTest, LimitTotal) { 345 TEST_F(WorkerTest, LimitTotal) {
356 int max_workers_per_tab = WorkerService::kMaxWorkersPerTabWhenSeparate; 346 int max_workers_per_tab = WorkerService::kMaxWorkersPerTabWhenSeparate;
357 int total_workers = WorkerService::kMaxWorkersWhenSeparate; 347 int total_workers = WorkerService::kMaxWorkersWhenSeparate;
358 348
359 int tab_count = (total_workers / max_workers_per_tab) + 1; 349 int tab_count = (total_workers / max_workers_per_tab) + 1;
360 GURL url = GetTestUrl(L"workers", L"many_workers.html"); 350 GURL url = GetTestUrl(L"workers", L"many_workers.html");
361 url = GURL(url.spec() + StringPrintf("?count=%d", max_workers_per_tab)); 351 url = GURL(url.spec() + StringPrintf("?count=%d", max_workers_per_tab));
362 352
363 scoped_refptr<TabProxy> tab(GetActiveTab()); 353 scoped_refptr<TabProxy> tab(GetActiveTab());
364 ASSERT_TRUE(tab.get()); 354 ASSERT_TRUE(tab.get());
365 ASSERT_TRUE(tab->NavigateToURL(url)); 355 ASSERT_TRUE(tab->NavigateToURL(url));
366 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); 356 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
367 for (int i = 1; i < tab_count; ++i) 357 for (int i = 1; i < tab_count; ++i)
368 window->AppendTab(url); 358 window->AppendTab(url);
369 359
370 // Check that we didn't create more than the max number of workers. 360 // Check that we didn't create more than the max number of workers.
371 ASSERT_TRUE(WaitForProcessCountToBe(tab_count, total_workers)); 361 ASSERT_TRUE(WaitForProcessCountToBe(tab_count, total_workers));
372 362
373 // Now close a page and check that the queued workers were started. 363 // Now close a page and check that the queued workers were started.
374 tab->NavigateToURL(GetTestUrl(L"google", L"google.html")); 364 tab->NavigateToURL(GetTestUrl(L"google", L"google.html"));
375 365
376 ASSERT_TRUE(WaitForProcessCountToBe(tab_count, total_workers)); 366 ASSERT_TRUE(WaitForProcessCountToBe(tab_count, total_workers));
377 } 367 }
OLDNEW
« no previous file with comments | « chrome/test/data/workers/worker_utils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698