| 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 <math.h> | 5 #include <math.h> |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::ForCurrentProcess()->HasSwitch(kRunOmniboxTest)) | 136 if (!CommandLine::ForCurrentProcess()->HasSwitch(kRunOmniboxTest)) |
| 137 return; | 137 return; |
| 138 | 138 |
| 139 std::wstring omnibox_tests_path; | 139 FilePath omnibox_tests_path; |
| 140 PathService::Get(chrome::DIR_TEST_DATA, &omnibox_tests_path); | 140 PathService::Get(chrome::DIR_TEST_DATA, &omnibox_tests_path); |
| 141 file_util::AppendToPath(&omnibox_tests_path, L"omnibox_tests.xml"); | 141 omnibox_tests_path = omnibox_tests_path.AppendASCII("omnibox_tests.xml"); |
| 142 | 142 |
| 143 XmlReader reader; | 143 XmlReader reader; |
| 144 ASSERT_TRUE(reader.LoadFile(WideToASCII(omnibox_tests_path))); | 144 ASSERT_TRUE(reader.LoadFile(WideToASCII(omnibox_tests_path.ToWStringHack()))); |
| 145 while (reader.SkipToElement()) { | 145 while (reader.SkipToElement()) { |
| 146 ASSERT_EQ("omnibox_tests", reader.NodeName()); | 146 ASSERT_EQ("omnibox_tests", reader.NodeName()); |
| 147 reader.Read(); | 147 reader.Read(); |
| 148 while (reader.SkipToElement()) { | 148 while (reader.SkipToElement()) { |
| 149 ASSERT_EQ("test", reader.NodeName()); | 149 ASSERT_EQ("test", reader.NodeName()); |
| 150 std::string query; | 150 std::string query; |
| 151 std::vector<std::string> expected_providers; | 151 std::vector<std::string> expected_providers; |
| 152 ASSERT_TRUE(reader.NodeAttribute("query", &query)); | 152 ASSERT_TRUE(reader.NodeAttribute("query", &query)); |
| 153 reader.Read(); | 153 reader.Read(); |
| 154 while (reader.SkipToElement()) { | 154 while (reader.SkipToElement()) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 170 wprintf(L"__om_query_count = %d\n", query_count_); | 170 wprintf(L"__om_query_count = %d\n", query_count_); |
| 171 wprintf(L"__om_query_timeouts = %d\n", query_timeouts_); | 171 wprintf(L"__om_query_timeouts = %d\n", query_timeouts_); |
| 172 wprintf(L"__om_time_per_query_avg = %d\n", mean); | 172 wprintf(L"__om_time_per_query_avg = %d\n", mean); |
| 173 // 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). |
| 174 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>( |
| 175 sqrt(1.0 * time_squared_ / query_count_ - mean * mean))); | 175 sqrt(1.0 * time_squared_ / query_count_ - mean * mean))); |
| 176 wprintf(L"__om_time_per_query_max = %d\n", time_max_); | 176 wprintf(L"__om_time_per_query_max = %d\n", time_max_); |
| 177 wprintf(L"__om_time_per_query_min = %d\n", time_min_); | 177 wprintf(L"__om_time_per_query_min = %d\n", time_min_); |
| 178 wprintf(L"__om_score = %.4f\n", 100.0 * score_ / max_score_); | 178 wprintf(L"__om_score = %.4f\n", 100.0 * score_ / max_score_); |
| 179 } | 179 } |
| OLD | NEW |