| 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 "chrome/test/ui/ui_test.h" | 5 #include "chrome/test/ui/ui_test.h" |
| 6 | 6 |
| 7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
| 8 #include <signal.h> | 8 #include <signal.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 #endif | 10 #endif |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "chrome/test/automation/javascript_execution_controller.h" | 44 #include "chrome/test/automation/javascript_execution_controller.h" |
| 45 #include "chrome/test/automation/proxy_launcher.h" | 45 #include "chrome/test/automation/proxy_launcher.h" |
| 46 #include "chrome/test/automation/tab_proxy.h" | 46 #include "chrome/test/automation/tab_proxy.h" |
| 47 #include "chrome/test/automation/window_proxy.h" | 47 #include "chrome/test/automation/window_proxy.h" |
| 48 #include "chrome/test/base/chrome_process_util.h" | 48 #include "chrome/test/base/chrome_process_util.h" |
| 49 #include "chrome/test/base/test_switches.h" | 49 #include "chrome/test/base/test_switches.h" |
| 50 #include "content/common/debug_flags.h" | 50 #include "content/common/debug_flags.h" |
| 51 #include "googleurl/src/gurl.h" | 51 #include "googleurl/src/gurl.h" |
| 52 #include "net/base/net_util.h" | 52 #include "net/base/net_util.h" |
| 53 #include "ui/gfx/gl/gl_implementation.h" | 53 #include "ui/gfx/gl/gl_implementation.h" |
| 54 #include "ui/gfx/gl/gl_switches.h" | |
| 55 | 54 |
| 56 #if defined(OS_WIN) | 55 #if defined(OS_WIN) |
| 57 #include "base/win/windows_version.h" | 56 #include "base/win/windows_version.h" |
| 58 #endif | 57 #endif |
| 59 | 58 |
| 60 | 59 |
| 61 using base::Time; | 60 using base::Time; |
| 62 using base::TimeDelta; | 61 using base::TimeDelta; |
| 63 using base::TimeTicks; | 62 using base::TimeTicks; |
| 64 | 63 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 83 : launch_arguments_(CommandLine::NO_PROGRAM), | 82 : launch_arguments_(CommandLine::NO_PROGRAM), |
| 84 expected_errors_(0), | 83 expected_errors_(0), |
| 85 expected_crashes_(0), | 84 expected_crashes_(0), |
| 86 homepage_(chrome::kAboutBlankURL), | 85 homepage_(chrome::kAboutBlankURL), |
| 87 wait_for_initial_loads_(true), | 86 wait_for_initial_loads_(true), |
| 88 dom_automation_enabled_(false), | 87 dom_automation_enabled_(false), |
| 89 show_window_(false), | 88 show_window_(false), |
| 90 clear_profile_(true), | 89 clear_profile_(true), |
| 91 include_testing_id_(true), | 90 include_testing_id_(true), |
| 92 enable_file_cookies_(true), | 91 enable_file_cookies_(true), |
| 93 profile_type_(UITestBase::DEFAULT_THEME), | 92 profile_type_(UITestBase::DEFAULT_THEME) { |
| 94 force_use_osmesa_(true), | |
| 95 disable_accelerated_compositing_(true) { | |
| 96 PathService::Get(chrome::DIR_APP, &browser_directory_); | 93 PathService::Get(chrome::DIR_APP, &browser_directory_); |
| 97 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); | 94 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); |
| 98 } | 95 } |
| 99 | 96 |
| 100 UITestBase::UITestBase(MessageLoop::Type msg_loop_type) | 97 UITestBase::UITestBase(MessageLoop::Type msg_loop_type) |
| 101 : launch_arguments_(CommandLine::NO_PROGRAM), | 98 : launch_arguments_(CommandLine::NO_PROGRAM), |
| 102 expected_errors_(0), | 99 expected_errors_(0), |
| 103 expected_crashes_(0), | 100 expected_crashes_(0), |
| 104 wait_for_initial_loads_(true), | 101 wait_for_initial_loads_(true), |
| 105 dom_automation_enabled_(false), | 102 dom_automation_enabled_(false), |
| 106 show_window_(false), | 103 show_window_(false), |
| 107 clear_profile_(true), | 104 clear_profile_(true), |
| 108 include_testing_id_(true), | 105 include_testing_id_(true), |
| 109 enable_file_cookies_(true), | 106 enable_file_cookies_(true), |
| 110 profile_type_(UITestBase::DEFAULT_THEME), | 107 profile_type_(UITestBase::DEFAULT_THEME) { |
| 111 force_use_osmesa_(true), | |
| 112 disable_accelerated_compositing_(true) { | |
| 113 PathService::Get(chrome::DIR_APP, &browser_directory_); | 108 PathService::Get(chrome::DIR_APP, &browser_directory_); |
| 114 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); | 109 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); |
| 115 } | 110 } |
| 116 | 111 |
| 117 UITestBase::~UITestBase() {} | 112 UITestBase::~UITestBase() {} |
| 118 | 113 |
| 119 void UITestBase::SetUp() { | 114 void UITestBase::SetUp() { |
| 120 // Tests that do a session restore (e.g. SessionRestoreUITest, StartupTest) | 115 // Tests that do a session restore (e.g. SessionRestoreUITest, StartupTest) |
| 121 // call SetUp() multiple times because they restart the browser mid-test. | 116 // call SetUp() multiple times because they restart the browser mid-test. |
| 122 // We don't want to reset the ProxyLauncher's state in those cases. | 117 // We don't want to reset the ProxyLauncher's state in those cases. |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 void UITest::SetUp() { | 508 void UITest::SetUp() { |
| 514 // Pass the test case name to chrome.exe on the command line to help with | 509 // Pass the test case name to chrome.exe on the command line to help with |
| 515 // parsing Purify output. | 510 // parsing Purify output. |
| 516 const testing::TestInfo* const test_info = | 511 const testing::TestInfo* const test_info = |
| 517 testing::UnitTest::GetInstance()->current_test_info(); | 512 testing::UnitTest::GetInstance()->current_test_info(); |
| 518 if (test_info) { | 513 if (test_info) { |
| 519 set_test_name(test_info->test_case_name() + std::string(".") + | 514 set_test_name(test_info->test_case_name() + std::string(".") + |
| 520 test_info->name()); | 515 test_info->name()); |
| 521 } | 516 } |
| 522 | 517 |
| 523 // UI tests force the use of OSMesa by default because of various bad | |
| 524 // interactions between the GPU infrastructure, how our bots are configured, | |
| 525 // and existing performance expectations. The goal to slowly remove these | |
| 526 // special cases, as covered by: | |
| 527 // http://code.google.com/p/chromium/issues/detail?id=95782 | |
| 528 // | |
| 529 // Note also that this disabling is done in UITest to avoid affecting | |
| 530 // pyautolib, which runs tests that do not work with OSMesa. | |
| 531 if (force_use_osmesa_) { | |
| 532 launch_arguments_.AppendSwitchASCII(switches::kUseGL, | |
| 533 gfx::kGLImplementationOSMesaName); | |
| 534 } | |
| 535 | |
| 536 // Disable acclerated compositing for tests unless they directly opt-in. The | |
| 537 // rationale for this is identical to the use of OSMesa: bad interactions | |
| 538 // between tests and the accelerated compositing system. The goal is to slowly | |
| 539 // remove this flag, as covered by: | |
| 540 // http://code.google.com/p/chromium/issues/detail?id=95782 | |
| 541 if (disable_accelerated_compositing_) | |
| 542 launch_arguments_.AppendSwitch(switches::kDisableAcceleratedCompositing); | |
| 543 | |
| 544 UITestBase::SetUp(); | 518 UITestBase::SetUp(); |
| 545 PlatformTest::SetUp(); | 519 PlatformTest::SetUp(); |
| 546 } | 520 } |
| 547 | 521 |
| 548 void UITest::TearDown() { | 522 void UITest::TearDown() { |
| 549 UITestBase::TearDown(); | 523 UITestBase::TearDown(); |
| 550 PlatformTest::TearDown(); | 524 PlatformTest::TearDown(); |
| 551 } | 525 } |
| 552 | 526 |
| 553 ProxyLauncher* UITest::CreateProxyLauncher() { | 527 ProxyLauncher* UITest::CreateProxyLauncher() { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms() / kCycles); | 790 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms() / kCycles); |
| 817 } | 791 } |
| 818 | 792 |
| 819 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() | 793 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() |
| 820 << " seconds" | 794 << " seconds" |
| 821 << " call failed " << fail_count << " times" | 795 << " call failed " << fail_count << " times" |
| 822 << " state was incorrect " << incorrect_state_count << " times"; | 796 << " state was incorrect " << incorrect_state_count << " times"; |
| 823 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; | 797 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; |
| 824 return false; | 798 return false; |
| 825 } | 799 } |
| OLD | NEW |