| 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" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 #include "chrome/test/base/default_ash_event_generator_delegate.h" | 86 #include "chrome/test/base/default_ash_event_generator_delegate.h" |
| 87 #endif | 87 #endif |
| 88 | 88 |
| 89 namespace { | 89 namespace { |
| 90 | 90 |
| 91 // Passed as value of kTestType. | 91 // Passed as value of kTestType. |
| 92 const char kBrowserTestType[] = "browser"; | 92 const char kBrowserTestType[] = "browser"; |
| 93 | 93 |
| 94 } // namespace | 94 } // namespace |
| 95 | 95 |
| 96 // static |
| 97 InProcessBrowserTest::SetUpBrowserFunction* |
| 98 InProcessBrowserTest::global_browser_set_up_function_ = nullptr; |
| 99 |
| 96 // Library used for testing accessibility. | 100 // Library used for testing accessibility. |
| 97 const base::FilePath::CharType kAXSTesting[] = | 101 const base::FilePath::CharType kAXSTesting[] = |
| 98 FILE_PATH_LITERAL("third_party/accessibility-audit/axs_testing.js"); | 102 FILE_PATH_LITERAL("third_party/accessibility-audit/axs_testing.js"); |
| 99 // JavaScript snippet to configure and run the accessibility audit. | 103 // JavaScript snippet to configure and run the accessibility audit. |
| 100 const char kAccessibilityTestString[] = | 104 const char kAccessibilityTestString[] = |
| 101 "var config = new axs.AuditConfiguration();" | 105 "var config = new axs.AuditConfiguration();" |
| 102 "/* Disable warning about rules that cannot be checked. */" | 106 "/* Disable warning about rules that cannot be checked. */" |
| 103 "config.showUnsupportedRulesWarning = false;" | 107 "config.showUnsupportedRulesWarning = false;" |
| 104 "config.auditRulesToIgnore = [" | 108 "config.auditRulesToIgnore = [" |
| 105 " /*" | 109 " /*" |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 | 532 |
| 529 // Pump any pending events that were created as a result of creating a | 533 // Pump any pending events that were created as a result of creating a |
| 530 // browser. | 534 // browser. |
| 531 content::RunAllPendingInMessageLoop(); | 535 content::RunAllPendingInMessageLoop(); |
| 532 | 536 |
| 533 // run_accessibility_checks_for_test_case_ must be set before calling | 537 // run_accessibility_checks_for_test_case_ must be set before calling |
| 534 // SetUpOnMainThread or RunTestOnMainThread so that one or all tests can | 538 // SetUpOnMainThread or RunTestOnMainThread so that one or all tests can |
| 535 // enable/disable the accessibility audit. | 539 // enable/disable the accessibility audit. |
| 536 run_accessibility_checks_for_test_case_ = false; | 540 run_accessibility_checks_for_test_case_ = false; |
| 537 | 541 |
| 542 if (browser_ && global_browser_set_up_function_) |
| 543 ASSERT_TRUE(global_browser_set_up_function_(browser_)); |
| 544 |
| 538 SetUpOnMainThread(); | 545 SetUpOnMainThread(); |
| 539 #if defined(OS_MACOSX) | 546 #if defined(OS_MACOSX) |
| 540 autorelease_pool_->Recycle(); | 547 autorelease_pool_->Recycle(); |
| 541 #endif | 548 #endif |
| 542 | 549 |
| 543 if (!HasFatalFailure()) | 550 if (!HasFatalFailure()) |
| 544 RunTestOnMainThread(); | 551 RunTestOnMainThread(); |
| 545 #if defined(OS_MACOSX) | 552 #if defined(OS_MACOSX) |
| 546 autorelease_pool_->Recycle(); | 553 autorelease_pool_->Recycle(); |
| 547 #endif | 554 #endif |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 // On the Mac, this eventually reaches | 598 // On the Mac, this eventually reaches |
| 592 // -[BrowserWindowController windowWillClose:], which will post a deferred | 599 // -[BrowserWindowController windowWillClose:], which will post a deferred |
| 593 // -autorelease on itself to ultimately destroy the Browser object. The line | 600 // -autorelease on itself to ultimately destroy the Browser object. The line |
| 594 // below is necessary to pump these pending messages to ensure all Browsers | 601 // below is necessary to pump these pending messages to ensure all Browsers |
| 595 // get deleted. | 602 // get deleted. |
| 596 content::RunAllPendingInMessageLoop(); | 603 content::RunAllPendingInMessageLoop(); |
| 597 delete autorelease_pool_; | 604 delete autorelease_pool_; |
| 598 autorelease_pool_ = NULL; | 605 autorelease_pool_ = NULL; |
| 599 #endif | 606 #endif |
| 600 } | 607 } |
| OLD | NEW |