| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // This could probably be accomplished with regex as well. Note that this | 50 // This could probably be accomplished with regex as well. Note that this |
| 51 // method is called even when suggestion isn't a URL. | 51 // method is called even when suggestion isn't a URL. |
| 52 bool IsMatch(const std::wstring& input_test, const std::wstring& suggestion); | 52 bool IsMatch(const std::wstring& input_test, const std::wstring& suggestion); |
| 53 // Runs a query chain. This sends each proper prefix of the input to the | 53 // Runs a query chain. This sends each proper prefix of the input to the |
| 54 // omnibox and scores the autocompelte results returned. | 54 // omnibox and scores the autocompelte results returned. |
| 55 void RunQueryChain(const std::wstring& input_text); | 55 void RunQueryChain(const std::wstring& input_text); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 bool OmniboxTest::IsMatch(const std::wstring& input_text, | 58 bool OmniboxTest::IsMatch(const std::wstring& input_text, |
| 59 const std::wstring& suggestion) { | 59 const std::wstring& suggestion) { |
| 60 // This prefix list comes from the list used in history_url_provider.cc withif
f | 60 // This prefix list comes from the list used in history_url_provider.cc |
| 61 // the exception of "ftp." and "www.". | 61 // withiff the exception of "ftp." and "www.". |
| 62 std::wstring prefixes[] = {L"", L"ftp://", L"http://", L"https://", | 62 std::wstring prefixes[] = {L"", L"ftp://", L"http://", L"https://", |
| 63 L"ftp.", L"www.", L"ftp://www.", L"ftp://ftp.", | 63 L"ftp.", L"www.", L"ftp://www.", L"ftp://ftp.", |
| 64 L"http://www.", L"https://www."}; | 64 L"http://www.", L"https://www."}; |
| 65 std::wstring postfixes[] = {L"", L"/"}; | 65 std::wstring postfixes[] = {L"", L"/"}; |
| 66 for (int i = 0; i < sizeof(prefixes) / sizeof(std::wstring); ++i) { | 66 for (int i = 0; i < sizeof(prefixes) / sizeof(std::wstring); ++i) { |
| 67 for (int j = 0; j < sizeof(postfixes) / sizeof(std::wstring); ++j) { | 67 for (int j = 0; j < sizeof(postfixes) / sizeof(std::wstring); ++j) { |
| 68 if (prefixes[i] + input_text + postfixes[j] == suggestion) | 68 if (prefixes[i] + input_text + postfixes[j] == suggestion) |
| 69 return true; | 69 return true; |
| 70 } | 70 } |
| 71 } | 71 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 wprintf(L"__om_query_timeouts = %d\n", query_timeouts_); | 170 wprintf(L"__om_query_timeouts = %d\n", query_timeouts_); |
| 171 wprintf(L"__om_time_per_query_avg = %d\n", mean); | 171 wprintf(L"__om_time_per_query_avg = %d\n", mean); |
| 172 // Use the equation stddev = sqrt(Sum(x_i^2)/N - mean^2). | 172 // 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>( | 173 wprintf(L"__om_time_per_query_stddev = %d\n", static_cast<int64>( |
| 174 sqrt(1.0 * time_squared_ / query_count_ - mean * mean))); | 174 sqrt(1.0 * time_squared_ / query_count_ - mean * mean))); |
| 175 wprintf(L"__om_time_per_query_max = %d\n", time_max_); | 175 wprintf(L"__om_time_per_query_max = %d\n", time_max_); |
| 176 wprintf(L"__om_time_per_query_min = %d\n", time_min_); | 176 wprintf(L"__om_time_per_query_min = %d\n", time_min_); |
| 177 wprintf(L"__om_score = %.4f\n", 100.0 * score_ / max_score_); | 177 wprintf(L"__om_score = %.4f\n", 100.0 * score_ / max_score_); |
| 178 } | 178 } |
| 179 | 179 |
| OLD | NEW |