| 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 "chrome/test/base/in_process_browser_test.h" | 5 #include "chrome/test/base/in_process_browser_test.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_switches.h" | 7 #include "ash/common/ash_switches.h" |
| 8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/feature_list.h" | 11 #include "base/feature_list.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 20 #include "base/test/test_file_util.h" | 20 #include "base/test/test_file_util.h" |
| 21 #include "base/threading/non_thread_safe.h" | 21 #include "base/threading/non_thread_safe.h" |
| 22 #include "base/threading/thread_restrictions.h" |
| 22 #include "base/threading/thread_task_runner_handle.h" | 23 #include "base/threading/thread_task_runner_handle.h" |
| 23 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 24 #include "chrome/browser/after_startup_task_utils.h" | 25 #include "chrome/browser/after_startup_task_utils.h" |
| 25 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
| 26 #include "chrome/browser/chrome_notification_types.h" | 27 #include "chrome/browser/chrome_notification_types.h" |
| 27 #include "chrome/browser/devtools/devtools_window.h" | 28 #include "chrome/browser/devtools/devtools_window.h" |
| 28 #include "chrome/browser/lifetime/application_lifetime.h" | 29 #include "chrome/browser/lifetime/application_lifetime.h" |
| 29 #include "chrome/browser/net/net_error_tab_helper.h" | 30 #include "chrome/browser/net/net_error_tab_helper.h" |
| 30 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
| 31 #include "chrome/browser/profiles/profile_manager.h" | 32 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 // run_accessibility_checks_for_test_case_ must be set before calling | 534 // run_accessibility_checks_for_test_case_ must be set before calling |
| 534 // SetUpOnMainThread or RunTestOnMainThread so that one or all tests can | 535 // SetUpOnMainThread or RunTestOnMainThread so that one or all tests can |
| 535 // enable/disable the accessibility audit. | 536 // enable/disable the accessibility audit. |
| 536 run_accessibility_checks_for_test_case_ = false; | 537 run_accessibility_checks_for_test_case_ = false; |
| 537 | 538 |
| 538 SetUpOnMainThread(); | 539 SetUpOnMainThread(); |
| 539 #if defined(OS_MACOSX) | 540 #if defined(OS_MACOSX) |
| 540 autorelease_pool_->Recycle(); | 541 autorelease_pool_->Recycle(); |
| 541 #endif | 542 #endif |
| 542 | 543 |
| 543 if (!HasFatalFailure()) | 544 if (!HasFatalFailure()) { |
| 545 bool old_io_allowed_value = base::ThreadRestrictions::SetIOAllowed(false); |
| 544 RunTestOnMainThread(); | 546 RunTestOnMainThread(); |
| 547 base::ThreadRestrictions::SetIOAllowed(old_io_allowed_value); |
| 548 } |
| 545 #if defined(OS_MACOSX) | 549 #if defined(OS_MACOSX) |
| 546 autorelease_pool_->Recycle(); | 550 autorelease_pool_->Recycle(); |
| 547 #endif | 551 #endif |
| 548 | 552 |
| 549 if (run_accessibility_checks_for_test_case_) { | 553 if (run_accessibility_checks_for_test_case_) { |
| 550 std::string error_message; | 554 std::string error_message; |
| 551 EXPECT_TRUE(RunAccessibilityChecks(&error_message)); | 555 EXPECT_TRUE(RunAccessibilityChecks(&error_message)); |
| 552 EXPECT_EQ("", error_message); | 556 EXPECT_EQ("", error_message); |
| 553 } | 557 } |
| 554 | 558 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 // On the Mac, this eventually reaches | 595 // On the Mac, this eventually reaches |
| 592 // -[BrowserWindowController windowWillClose:], which will post a deferred | 596 // -[BrowserWindowController windowWillClose:], which will post a deferred |
| 593 // -autorelease on itself to ultimately destroy the Browser object. The line | 597 // -autorelease on itself to ultimately destroy the Browser object. The line |
| 594 // below is necessary to pump these pending messages to ensure all Browsers | 598 // below is necessary to pump these pending messages to ensure all Browsers |
| 595 // get deleted. | 599 // get deleted. |
| 596 content::RunAllPendingInMessageLoop(); | 600 content::RunAllPendingInMessageLoop(); |
| 597 delete autorelease_pool_; | 601 delete autorelease_pool_; |
| 598 autorelease_pool_ = NULL; | 602 autorelease_pool_ = NULL; |
| 599 #endif | 603 #endif |
| 600 } | 604 } |
| OLD | NEW |