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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/environment.h" | 6 #include "base/environment.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // Close the browser to force a dump of log. | 106 // Close the browser to force a dump of log. |
107 bool application_closed = false; | 107 bool application_closed = false; |
108 EXPECT_TRUE(CloseBrowser(browser_proxy_.get(), &application_closed)); | 108 EXPECT_TRUE(CloseBrowser(browser_proxy_.get(), &application_closed)); |
109 | 109 |
110 // Open the corresponding log file and collect average from the | 110 // Open the corresponding log file and collect average from the |
111 // histogram stats generated for RenderWidgetHost_TabSwitchPaintDuration. | 111 // histogram stats generated for RenderWidgetHost_TabSwitchPaintDuration. |
112 bool log_has_been_dumped = false; | 112 bool log_has_been_dumped = false; |
113 std::string contents; | 113 std::string contents; |
114 int max_tries = 20; | 114 int max_tries = 20; |
115 do { | 115 do { |
116 log_has_been_dumped = file_util::ReadFileToString(log_file_name_, | 116 log_has_been_dumped = base::ReadFileToString(log_file_name_, &contents); |
117 &contents); | |
118 if (!log_has_been_dumped) | 117 if (!log_has_been_dumped) |
119 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); | 118 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); |
120 } while (!log_has_been_dumped && max_tries--); | 119 } while (!log_has_been_dumped && max_tries--); |
121 ASSERT_TRUE(log_has_been_dumped) << "Failed to read the log file"; | 120 ASSERT_TRUE(log_has_been_dumped) << "Failed to read the log file"; |
122 | 121 |
123 // Parse the contents to get average. | 122 // Parse the contents to get average. |
124 int64 average = 0; | 123 int64 average = 0; |
125 const std::string average_str("average = "); | 124 const std::string average_str("average = "); |
126 std::string::size_type pos = contents.find( | 125 std::string::size_type pos = contents.find( |
127 "Histogram: MPArch.RWH_TabSwitchPaintDuration", 0); | 126 "Histogram: MPArch.RWH_TabSwitchPaintDuration", 0); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 RunTabSwitchingUITest("t", true); | 192 RunTabSwitchingUITest("t", true); |
194 } | 193 } |
195 | 194 |
196 // Started failing with a webkit roll in r49936. See http://crbug.com/46751 | 195 // Started failing with a webkit roll in r49936. See http://crbug.com/46751 |
197 TEST_F(TabSwitchingUITest, DISABLED_TabSwitchRef) { | 196 TEST_F(TabSwitchingUITest, DISABLED_TabSwitchRef) { |
198 UseReferenceBuild(); | 197 UseReferenceBuild(); |
199 RunTabSwitchingUITest("t_ref", true); | 198 RunTabSwitchingUITest("t_ref", true); |
200 } | 199 } |
201 | 200 |
202 } // namespace | 201 } // namespace |
OLD | NEW |