| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/cancelable_callback.h" | 6 #include "base/cancelable_callback.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 } | 309 } |
| 310 }; | 310 }; |
| 311 | 311 |
| 312 class DevToolsUnresponsiveBeforeUnloadTest: public DevToolsBeforeUnloadTest { | 312 class DevToolsUnresponsiveBeforeUnloadTest: public DevToolsBeforeUnloadTest { |
| 313 public: | 313 public: |
| 314 void SetUpCommandLine(base::CommandLine* command_line) override {} | 314 void SetUpCommandLine(base::CommandLine* command_line) override {} |
| 315 }; | 315 }; |
| 316 | 316 |
| 317 void TimeoutCallback(const std::string& timeout_message) { | 317 void TimeoutCallback(const std::string& timeout_message) { |
| 318 ADD_FAILURE() << timeout_message; | 318 ADD_FAILURE() << timeout_message; |
| 319 base::MessageLoop::current()->Quit(); | 319 base::MessageLoop::current()->QuitWhenIdle(); |
| 320 } | 320 } |
| 321 | 321 |
| 322 // Base class for DevTools tests that test devtools functionality for | 322 // Base class for DevTools tests that test devtools functionality for |
| 323 // extensions and content scripts. | 323 // extensions and content scripts. |
| 324 class DevToolsExtensionTest : public DevToolsSanityTest, | 324 class DevToolsExtensionTest : public DevToolsSanityTest, |
| 325 public content::NotificationObserver { | 325 public content::NotificationObserver { |
| 326 public: | 326 public: |
| 327 DevToolsExtensionTest() : DevToolsSanityTest() { | 327 DevToolsExtensionTest() : DevToolsSanityTest() { |
| 328 PathService::Get(chrome::DIR_TEST_DATA, &test_extensions_dir_); | 328 PathService::Get(chrome::DIR_TEST_DATA, &test_extensions_dir_); |
| 329 test_extensions_dir_ = test_extensions_dir_.AppendASCII("devtools"); | 329 test_extensions_dir_ = test_extensions_dir_.AppendASCII("devtools"); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 timeout.Cancel(); | 393 timeout.Cancel(); |
| 394 return true; | 394 return true; |
| 395 } | 395 } |
| 396 | 396 |
| 397 void Observe(int type, | 397 void Observe(int type, |
| 398 const content::NotificationSource& source, | 398 const content::NotificationSource& source, |
| 399 const content::NotificationDetails& details) override { | 399 const content::NotificationDetails& details) override { |
| 400 switch (type) { | 400 switch (type) { |
| 401 case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: | 401 case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: |
| 402 case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD: | 402 case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD: |
| 403 base::MessageLoopForUI::current()->Quit(); | 403 base::MessageLoopForUI::current()->QuitWhenIdle(); |
| 404 break; | 404 break; |
| 405 default: | 405 default: |
| 406 NOTREACHED(); | 406 NOTREACHED(); |
| 407 break; | 407 break; |
| 408 } | 408 } |
| 409 } | 409 } |
| 410 | 410 |
| 411 base::FilePath test_extensions_dir_; | 411 base::FilePath test_extensions_dir_; |
| 412 }; | 412 }; |
| 413 | 413 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 void WorkerCreated(const GURL& url, | 447 void WorkerCreated(const GURL& url, |
| 448 const base::string16& name, | 448 const base::string16& name, |
| 449 int process_id, | 449 int process_id, |
| 450 int route_id) override { | 450 int route_id) override { |
| 451 if (url.path().rfind(path_) == std::string::npos) | 451 if (url.path().rfind(path_) == std::string::npos) |
| 452 return; | 452 return; |
| 453 worker_data_->worker_process_id = process_id; | 453 worker_data_->worker_process_id = process_id; |
| 454 worker_data_->worker_route_id = route_id; | 454 worker_data_->worker_route_id = route_id; |
| 455 WorkerService::GetInstance()->RemoveObserver(this); | 455 WorkerService::GetInstance()->RemoveObserver(this); |
| 456 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 456 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 457 base::MessageLoop::QuitClosure()); | 457 base::MessageLoop::QuitWhenIdleClosure()); |
| 458 delete this; | 458 delete this; |
| 459 } | 459 } |
| 460 std::string path_; | 460 std::string path_; |
| 461 scoped_refptr<WorkerData> worker_data_; | 461 scoped_refptr<WorkerData> worker_data_; |
| 462 }; | 462 }; |
| 463 | 463 |
| 464 class WorkerTerminationObserver : public WorkerServiceObserver { | 464 class WorkerTerminationObserver : public WorkerServiceObserver { |
| 465 public: | 465 public: |
| 466 explicit WorkerTerminationObserver(WorkerData* worker_data) | 466 explicit WorkerTerminationObserver(WorkerData* worker_data) |
| 467 : worker_data_(worker_data) { | 467 : worker_data_(worker_data) { |
| 468 } | 468 } |
| 469 | 469 |
| 470 private: | 470 private: |
| 471 ~WorkerTerminationObserver() override {} | 471 ~WorkerTerminationObserver() override {} |
| 472 | 472 |
| 473 void WorkerDestroyed(int process_id, int route_id) override { | 473 void WorkerDestroyed(int process_id, int route_id) override { |
| 474 ASSERT_EQ(worker_data_->worker_process_id, process_id); | 474 ASSERT_EQ(worker_data_->worker_process_id, process_id); |
| 475 ASSERT_EQ(worker_data_->worker_route_id, route_id); | 475 ASSERT_EQ(worker_data_->worker_route_id, route_id); |
| 476 WorkerService::GetInstance()->RemoveObserver(this); | 476 WorkerService::GetInstance()->RemoveObserver(this); |
| 477 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 477 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 478 base::MessageLoop::QuitClosure()); | 478 base::MessageLoop::QuitWhenIdleClosure()); |
| 479 delete this; | 479 delete this; |
| 480 } | 480 } |
| 481 scoped_refptr<WorkerData> worker_data_; | 481 scoped_refptr<WorkerData> worker_data_; |
| 482 }; | 482 }; |
| 483 | 483 |
| 484 void RunTest(const char* test_name, | 484 void RunTest(const char* test_name, |
| 485 const char* test_page, | 485 const char* test_page, |
| 486 const char* worker_path) { | 486 const char* worker_path) { |
| 487 ASSERT_TRUE(test_server()->Start()); | 487 ASSERT_TRUE(test_server()->Start()); |
| 488 GURL url = test_server()->GetURL(test_page); | 488 GURL url = test_server()->GetURL(test_page); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 514 const std::string& path, | 514 const std::string& path, |
| 515 scoped_refptr<WorkerData> worker_data) { | 515 scoped_refptr<WorkerData> worker_data) { |
| 516 std::vector<WorkerService::WorkerInfo> worker_info = | 516 std::vector<WorkerService::WorkerInfo> worker_info = |
| 517 WorkerService::GetInstance()->GetWorkers(); | 517 WorkerService::GetInstance()->GetWorkers(); |
| 518 for (size_t i = 0; i < worker_info.size(); i++) { | 518 for (size_t i = 0; i < worker_info.size(); i++) { |
| 519 if (worker_info[i].url.path().rfind(path) == std::string::npos) | 519 if (worker_info[i].url.path().rfind(path) == std::string::npos) |
| 520 continue; | 520 continue; |
| 521 worker_data->worker_process_id = worker_info[0].process_id; | 521 worker_data->worker_process_id = worker_info[0].process_id; |
| 522 worker_data->worker_route_id = worker_info[0].route_id; | 522 worker_data->worker_route_id = worker_info[0].route_id; |
| 523 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 523 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 524 base::MessageLoop::QuitClosure()); | 524 base::MessageLoop::QuitWhenIdleClosure()); |
| 525 return; | 525 return; |
| 526 } | 526 } |
| 527 | 527 |
| 528 WorkerService::GetInstance()->AddObserver( | 528 WorkerService::GetInstance()->AddObserver( |
| 529 new WorkerCreationObserver(path, worker_data.get())); | 529 new WorkerCreationObserver(path, worker_data.get())); |
| 530 } | 530 } |
| 531 | 531 |
| 532 static scoped_refptr<WorkerData> WaitForFirstSharedWorker(const char* path) { | 532 static scoped_refptr<WorkerData> WaitForFirstSharedWorker(const char* path) { |
| 533 scoped_refptr<WorkerData> worker_data(new WorkerData()); | 533 scoped_refptr<WorkerData> worker_data(new WorkerData()); |
| 534 BrowserThread::PostTask( | 534 BrowserThread::PostTask( |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 (defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD)) | 1037 (defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD)) |
| 1038 #define MAYBE_TestScreenshotRecording DISABLED_TestScreenshotRecording | 1038 #define MAYBE_TestScreenshotRecording DISABLED_TestScreenshotRecording |
| 1039 #else | 1039 #else |
| 1040 #define MAYBE_TestScreenshotRecording TestScreenshotRecording | 1040 #define MAYBE_TestScreenshotRecording TestScreenshotRecording |
| 1041 #endif | 1041 #endif |
| 1042 // Tests raw headers text. | 1042 // Tests raw headers text. |
| 1043 IN_PROC_BROWSER_TEST_F(DevToolsPixelOutputTests, | 1043 IN_PROC_BROWSER_TEST_F(DevToolsPixelOutputTests, |
| 1044 MAYBE_TestScreenshotRecording) { | 1044 MAYBE_TestScreenshotRecording) { |
| 1045 RunTest("testScreenshotRecording", std::string()); | 1045 RunTest("testScreenshotRecording", std::string()); |
| 1046 } | 1046 } |
| OLD | NEW |