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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 for (size_t j = 0; j < arraysize(postfixes); ++j) { | 67 for (size_t j = 0; j < arraysize(postfixes); ++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 } |
72 return false; | 72 return false; |
73 } | 73 } |
74 | 74 |
75 void OmniboxTest::RunQueryChain(const std::wstring& input_text) { | 75 void OmniboxTest::RunQueryChain(const std::wstring& input_text) { |
76 // Get a handle on the omnibox and give it focus. | 76 // Get a handle on the omnibox and give it focus. |
77 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 77 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
78 scoped_ptr<WindowProxy> window(browser->GetWindow()); | 78 scoped_refptr<WindowProxy> window(browser->GetWindow()); |
79 scoped_ptr<AutocompleteEditProxy> autocomplete_edit( | 79 scoped_refptr<AutocompleteEditProxy> autocomplete_edit( |
80 browser->GetAutocompleteEdit()); | 80 browser->GetAutocompleteEdit()); |
81 ASSERT_TRUE(browser->ApplyAccelerator(IDC_FOCUS_LOCATION)); | 81 ASSERT_TRUE(browser->ApplyAccelerator(IDC_FOCUS_LOCATION)); |
82 | 82 |
83 // Try every proper prefix of input_text. There's no use trying | 83 // Try every proper prefix of input_text. There's no use trying |
84 // input_text itself since the autocomplete results will always contain it. | 84 // input_text itself since the autocomplete results will always contain it. |
85 for (size_t i = 1; i < input_text.size(); ++i) { | 85 for (size_t i = 1; i < input_text.size(); ++i) { |
86 Matches matches; | 86 Matches matches; |
87 | 87 |
88 // We're only going to count the time elapsed waiting for autocomplete | 88 // We're only going to count the time elapsed waiting for autocomplete |
89 // matches to be returned to us. | 89 // matches to be returned to us. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 wprintf(L"__om_query_count = %d\n", query_count_); | 169 wprintf(L"__om_query_count = %d\n", query_count_); |
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 } |
OLD | NEW |