OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/test/base/in_process_browser_test.h" | 21 #include "chrome/test/base/in_process_browser_test.h" |
22 #include "chrome/test/base/ui_test_utils.h" | 22 #include "chrome/test/base/ui_test_utils.h" |
23 #include "content/browser/debugger/devtools_client_host.h" | 23 #include "content/browser/debugger/devtools_client_host.h" |
24 #include "content/browser/debugger/devtools_manager.h" | 24 #include "content/browser/debugger/devtools_manager.h" |
25 #include "content/browser/debugger/worker_devtools_manager.h" | 25 #include "content/browser/debugger/worker_devtools_manager.h" |
26 #include "content/browser/renderer_host/render_view_host.h" | 26 #include "content/browser/renderer_host/render_view_host.h" |
27 #include "content/browser/tab_contents/tab_contents.h" | 27 #include "content/browser/tab_contents/tab_contents.h" |
28 #include "content/browser/worker_host/worker_process_host.h" | 28 #include "content/browser/worker_host/worker_process_host.h" |
29 #include "content/browser/worker_host/worker_service.h" | 29 #include "content/browser/worker_host/worker_service.h" |
30 #include "content/browser/worker_host/worker_service_observer.h" | 30 #include "content/browser/worker_host/worker_service_observer.h" |
31 #include "content/common/worker_messages.h" | |
32 #include "content/public/browser/content_browser_client.h" | 31 #include "content/public/browser/content_browser_client.h" |
33 #include "content/public/browser/notification_registrar.h" | 32 #include "content/public/browser/notification_registrar.h" |
34 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
35 #include "net/test/test_server.h" | 34 #include "net/test/test_server.h" |
36 | 35 |
37 using content::BrowserThread; | 36 using content::BrowserThread; |
38 | 37 |
39 namespace { | 38 namespace { |
40 | 39 |
41 // Used to block until a dev tools client window's browser is closed. | 40 // Used to block until a dev tools client window's browser is closed. |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 RunTestFuntion(window_, test_name); | 348 RunTestFuntion(window_, test_name); |
350 CloseDevToolsWindow(); | 349 CloseDevToolsWindow(); |
351 } | 350 } |
352 | 351 |
353 static void TerminateWorkerOnIOThread( | 352 static void TerminateWorkerOnIOThread( |
354 scoped_refptr<WorkerData> worker_data) { | 353 scoped_refptr<WorkerData> worker_data) { |
355 for (BrowserChildProcessHost::Iterator iter( | 354 for (BrowserChildProcessHost::Iterator iter( |
356 ChildProcessInfo::WORKER_PROCESS); | 355 ChildProcessInfo::WORKER_PROCESS); |
357 !iter.Done(); ++iter) { | 356 !iter.Done(); ++iter) { |
358 if (iter->id() == worker_data->worker_process_id) { | 357 if (iter->id() == worker_data->worker_process_id) { |
359 (*iter)->Send(new WorkerMsg_TerminateWorkerContext( | 358 WorkerProcessHost* host = static_cast<WorkerProcessHost*>(*iter); |
360 worker_data->worker_route_id)); | 359 host->TerminateWorker(worker_data->worker_route_id); |
361 WorkerService::GetInstance()->AddObserver( | 360 WorkerService::GetInstance()->AddObserver( |
362 new WorkerTerminationObserver(worker_data)); | 361 new WorkerTerminationObserver(worker_data)); |
363 return; | 362 return; |
364 } | 363 } |
365 } | 364 } |
366 FAIL() << "Failed to terminate worker.\n"; | 365 FAIL() << "Failed to terminate worker.\n"; |
367 } | 366 } |
368 | 367 |
369 static void TerminateWorker(scoped_refptr<WorkerData> worker_data) { | 368 static void TerminateWorker(scoped_refptr<WorkerData> worker_data) { |
370 BrowserThread::PostTask( | 369 BrowserThread::PostTask( |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 | 570 |
572 // Reload page to restart the worker. | 571 // Reload page to restart the worker. |
573 ui_test_utils::NavigateToURL(browser(), url); | 572 ui_test_utils::NavigateToURL(browser(), url); |
574 | 573 |
575 // Wait until worker script is paused on the debugger statement. | 574 // Wait until worker script is paused on the debugger statement. |
576 RunTestFuntion(window_, "testPauseInSharedWorkerInitialization"); | 575 RunTestFuntion(window_, "testPauseInSharedWorkerInitialization"); |
577 CloseDevToolsWindow(); | 576 CloseDevToolsWindow(); |
578 } | 577 } |
579 | 578 |
580 } // namespace | 579 } // namespace |
OLD | NEW |