| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/environment.h" | 6 #include "base/environment.h" |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/platform_thread.h" | |
| 11 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "base/threading/platform_thread.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
| 15 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
| 16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 17 #include "chrome/common/env_vars.h" | 17 #include "chrome/common/env_vars.h" |
| 18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 19 #include "chrome/test/automation/tab_proxy.h" | 19 #include "chrome/test/automation/tab_proxy.h" |
| 20 #include "chrome/test/automation/browser_proxy.h" | 20 #include "chrome/test/automation/browser_proxy.h" |
| 21 #include "chrome/test/ui/ui_perf_test.h" | 21 #include "chrome/test/ui/ui_perf_test.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 // Open the corresponding log file and collect average from the | 106 // Open the corresponding log file and collect average from the |
| 107 // histogram stats generated for RenderWidgetHost_TabSwitchPaintDuration. | 107 // histogram stats generated for RenderWidgetHost_TabSwitchPaintDuration. |
| 108 bool log_has_been_dumped = false; | 108 bool log_has_been_dumped = false; |
| 109 std::string contents; | 109 std::string contents; |
| 110 int max_tries = 20; | 110 int max_tries = 20; |
| 111 do { | 111 do { |
| 112 log_has_been_dumped = file_util::ReadFileToString(log_file_name_, | 112 log_has_been_dumped = file_util::ReadFileToString(log_file_name_, |
| 113 &contents); | 113 &contents); |
| 114 if (!log_has_been_dumped) | 114 if (!log_has_been_dumped) |
| 115 PlatformThread::Sleep(100); | 115 base::PlatformThread::Sleep(100); |
| 116 } while (!log_has_been_dumped && max_tries--); | 116 } while (!log_has_been_dumped && max_tries--); |
| 117 ASSERT_TRUE(log_has_been_dumped) << "Failed to read the log file"; | 117 ASSERT_TRUE(log_has_been_dumped) << "Failed to read the log file"; |
| 118 | 118 |
| 119 // Parse the contents to get average. | 119 // Parse the contents to get average. |
| 120 int64 average = 0; | 120 int64 average = 0; |
| 121 const std::string average_str("average = "); | 121 const std::string average_str("average = "); |
| 122 std::string::size_type pos = contents.find( | 122 std::string::size_type pos = contents.find( |
| 123 "Histogram: MPArch.RWH_TabSwitchPaintDuration", 0); | 123 "Histogram: MPArch.RWH_TabSwitchPaintDuration", 0); |
| 124 std::string::size_type comma_pos; | 124 std::string::size_type comma_pos; |
| 125 std::string::size_type number_length; | 125 std::string::size_type number_length; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 TEST_F(TabSwitchingUITest, TabSwitch) { | 186 TEST_F(TabSwitchingUITest, TabSwitch) { |
| 187 RunTabSwitchingUITest("t", true); | 187 RunTabSwitchingUITest("t", true); |
| 188 } | 188 } |
| 189 | 189 |
| 190 TEST_F(TabSwitchingUITest, TabSwitchRef) { | 190 TEST_F(TabSwitchingUITest, TabSwitchRef) { |
| 191 UseReferenceBuild(); | 191 UseReferenceBuild(); |
| 192 RunTabSwitchingUITest("t_ref", true); | 192 RunTabSwitchingUITest("t_ref", true); |
| 193 } | 193 } |
| 194 | 194 |
| 195 } // namespace | 195 } // namespace |
| OLD | NEW |