| 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 #include "chrome_frame/test/perf/chrome_frame_perftest.h" | 4 #include "chrome_frame/test/perf/chrome_frame_perftest.h" |
| 5 | 5 |
| 6 #include <atlwin.h> | 6 #include <atlwin.h> |
| 7 #include <atlhost.h> | 7 #include <atlhost.h> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 CommandLine cmd_line(path); | 1491 CommandLine cmd_line(path); |
| 1492 // Always enable disabled tests. This method is not called with disabled | 1492 // Always enable disabled tests. This method is not called with disabled |
| 1493 // tests unless this flag was specified to the browser test executable. | 1493 // tests unless this flag was specified to the browser test executable. |
| 1494 cmd_line.AppendSwitch("gtest_also_run_disabled_tests"); | 1494 cmd_line.AppendSwitch("gtest_also_run_disabled_tests"); |
| 1495 cmd_line.AppendSwitchASCII("gtest_filter", test_name); | 1495 cmd_line.AppendSwitchASCII("gtest_filter", test_name); |
| 1496 | 1496 |
| 1497 base::ProcessHandle process_handle; | 1497 base::ProcessHandle process_handle; |
| 1498 if (!base::LaunchProcess(cmd_line, base::LaunchOptions(), &process_handle)) | 1498 if (!base::LaunchProcess(cmd_line, base::LaunchOptions(), &process_handle)) |
| 1499 return false; | 1499 return false; |
| 1500 | 1500 |
| 1501 int test_terminate_timeout_ms = 60 * 1000; | 1501 base::TimeDelta test_terminate_timeout = base::TimeDelta::FromMinutes(1); |
| 1502 int exit_code = 0; | 1502 int exit_code = 0; |
| 1503 if (!base::WaitForExitCodeWithTimeout(process_handle, &exit_code, | 1503 if (!base::WaitForExitCodeWithTimeout(process_handle, &exit_code, |
| 1504 test_terminate_timeout_ms)) { | 1504 test_terminate_timeout)) { |
| 1505 LOG(ERROR) << "Test timeout (" << test_terminate_timeout_ms | 1505 LOG(ERROR) << "Test timeout (" << test_terminate_timeout.InMilliseconds() |
| 1506 << " ms) exceeded for " << test_name; | 1506 << " ms) exceeded for " << test_name; |
| 1507 | 1507 |
| 1508 exit_code = -1; // Set a non-zero exit code to signal a failure. | 1508 exit_code = -1; // Set a non-zero exit code to signal a failure. |
| 1509 | 1509 |
| 1510 // Ensure that the process terminates. | 1510 // Ensure that the process terminates. |
| 1511 base::KillProcess(process_handle, -1, true); | 1511 base::KillProcess(process_handle, -1, true); |
| 1512 } | 1512 } |
| 1513 | 1513 |
| 1514 base::CloseProcessHandle(process_handle); | 1514 base::CloseProcessHandle(process_handle); |
| 1515 | 1515 |
| 1516 return exit_code == 0; | 1516 return exit_code == 0; |
| 1517 } | 1517 } |
| 1518 | 1518 |
| 1519 template <class Monitor> | 1519 template <class Monitor> |
| 1520 void PrintPerfTestResults(const Monitor* monitor, | 1520 void PrintPerfTestResults(const Monitor* monitor, |
| 1521 int num_cycles, | 1521 int num_cycles, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 PrintPerfTestResults(automation_provider_connect_monitor, kNumCycles, | 1600 PrintPerfTestResults(automation_provider_connect_monitor, kNumCycles, |
| 1601 "automationproviderconnect"); | 1601 "automationproviderconnect"); |
| 1602 PrintPerfTestResults(external_tab_navigate_monitor, kNumCycles, | 1602 PrintPerfTestResults(external_tab_navigate_monitor, kNumCycles, |
| 1603 "externaltabnavigate"); | 1603 "externaltabnavigate"); |
| 1604 PrintPerfTestResults(renderer_main_monitor, kNumCycles, | 1604 PrintPerfTestResults(renderer_main_monitor, kNumCycles, |
| 1605 "beginrenderermain"); | 1605 "beginrenderermain"); |
| 1606 #ifdef NDEBUG | 1606 #ifdef NDEBUG |
| 1607 PrintPerfTestResults(pre_read_chrome_monitor, kNumCycles, "PreReadImage"); | 1607 PrintPerfTestResults(pre_read_chrome_monitor, kNumCycles, "PreReadImage"); |
| 1608 #endif // NDEBUG | 1608 #endif // NDEBUG |
| 1609 } | 1609 } |
| OLD | NEW |