OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <stdio.h> | 5 #include <stdio.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.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/perftimer.h" | 10 #include "base/perftimer.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // done with the provider information. | 126 // done with the provider information. |
127 // <omnibox_tests> | 127 // <omnibox_tests> |
128 // Zero or more test elements. | 128 // Zero or more test elements. |
129 // <test query='%query%'> | 129 // <test query='%query%'> |
130 // Zero or more provider elements. | 130 // Zero or more provider elements. |
131 // <provider name='%expected_provider_name%'/> | 131 // <provider name='%expected_provider_name%'/> |
132 // </test> | 132 // </test> |
133 // </omnibox_tests> | 133 // </omnibox_tests> |
134 | 134 |
135 TEST_F(OmniboxTest, Measure) { | 135 TEST_F(OmniboxTest, Measure) { |
136 if (!CommandLine().HasSwitch(kRunOmniboxTest)) return; | 136 if (!CommandLine::ForCurrentProcess()->HasSwitch(kRunOmniboxTest)) |
| 137 return; |
137 | 138 |
138 std::wstring omnibox_tests_path; | 139 std::wstring omnibox_tests_path; |
139 PathService::Get(chrome::DIR_TEST_DATA, &omnibox_tests_path); | 140 PathService::Get(chrome::DIR_TEST_DATA, &omnibox_tests_path); |
140 file_util::AppendToPath(&omnibox_tests_path, L"omnibox_tests.xml"); | 141 file_util::AppendToPath(&omnibox_tests_path, L"omnibox_tests.xml"); |
141 | 142 |
142 XmlReader reader; | 143 XmlReader reader; |
143 ASSERT_TRUE(reader.LoadFile(WideToASCII(omnibox_tests_path))); | 144 ASSERT_TRUE(reader.LoadFile(WideToASCII(omnibox_tests_path))); |
144 while (reader.SkipToElement()) { | 145 while (reader.SkipToElement()) { |
145 ASSERT_EQ("omnibox_tests", reader.NodeName()); | 146 ASSERT_EQ("omnibox_tests", reader.NodeName()); |
146 reader.Read(); | 147 reader.Read(); |
(...skipping 23 matching lines...) Expand all Loading... |
170 wprintf(L"__om_query_timeouts = %d\n", query_timeouts_); | 171 wprintf(L"__om_query_timeouts = %d\n", query_timeouts_); |
171 wprintf(L"__om_time_per_query_avg = %d\n", mean); | 172 wprintf(L"__om_time_per_query_avg = %d\n", mean); |
172 // Use the equation stddev = sqrt(Sum(x_i^2)/N - mean^2). | 173 // Use the equation stddev = sqrt(Sum(x_i^2)/N - mean^2). |
173 wprintf(L"__om_time_per_query_stddev = %d\n", static_cast<int64>( | 174 wprintf(L"__om_time_per_query_stddev = %d\n", static_cast<int64>( |
174 sqrt(1.0 * time_squared_ / query_count_ - mean * mean))); | 175 sqrt(1.0 * time_squared_ / query_count_ - mean * mean))); |
175 wprintf(L"__om_time_per_query_max = %d\n", time_max_); | 176 wprintf(L"__om_time_per_query_max = %d\n", time_max_); |
176 wprintf(L"__om_time_per_query_min = %d\n", time_min_); | 177 wprintf(L"__om_time_per_query_min = %d\n", time_min_); |
177 wprintf(L"__om_score = %.4f\n", 100.0 * score_ / max_score_); | 178 wprintf(L"__om_score = %.4f\n", 100.0 * score_ / max_score_); |
178 } | 179 } |
179 | 180 |
OLD | NEW |