Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: chrome/test/ui/omnibox_uitest.cc

Issue 1547003: [GTTF] Miscellanous UI tests cleanups: (Closed)
Patch Set: updated Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/test/ui/mouseleave_uitest.cc ('k') | chrome/test/ui/v8_benchmark_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 if (prefixes[i] + input_text + postfixes[j] == suggestion) 69 if (prefixes[i] + input_text + postfixes[j] == suggestion)
70 return true; 70 return true;
71 } 71 }
72 } 72 }
73 return false; 73 return false;
74 } 74 }
75 75
76 void OmniboxTest::RunQueryChain(const std::wstring& input_text) { 76 void OmniboxTest::RunQueryChain(const std::wstring& input_text) {
77 // Get a handle on the omnibox and give it focus. 77 // Get a handle on the omnibox and give it focus.
78 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 78 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
79 ASSERT_TRUE(browser.get());
79 scoped_refptr<WindowProxy> window(browser->GetWindow()); 80 scoped_refptr<WindowProxy> window(browser->GetWindow());
81 ASSERT_TRUE(window.get());
80 scoped_refptr<AutocompleteEditProxy> autocomplete_edit( 82 scoped_refptr<AutocompleteEditProxy> autocomplete_edit(
81 browser->GetAutocompleteEdit()); 83 browser->GetAutocompleteEdit());
82 ASSERT_TRUE(browser->ApplyAccelerator(IDC_FOCUS_LOCATION)); 84 ASSERT_TRUE(browser->ApplyAccelerator(IDC_FOCUS_LOCATION));
83 85
84 // Try every proper prefix of input_text. There's no use trying 86 // Try every proper prefix of input_text. There's no use trying
85 // input_text itself since the autocomplete results will always contain it. 87 // input_text itself since the autocomplete results will always contain it.
86 for (size_t i = 1; i < input_text.size(); ++i) { 88 for (size_t i = 1; i < input_text.size(); ++i) {
87 Matches matches; 89 Matches matches;
88 90
89 // We're only going to count the time elapsed waiting for autocomplete 91 // We're only going to count the time elapsed waiting for autocomplete
90 // matches to be returned to us. 92 // matches to be returned to us.
91 ASSERT_TRUE(autocomplete_edit->SetText(input_text.substr(0, i))); 93 ASSERT_TRUE(autocomplete_edit->SetText(input_text.substr(0, i)));
92 PerfTimer timer; 94 PerfTimer timer;
93 if (autocomplete_edit->WaitForQuery(30000)) { 95 if (autocomplete_edit->WaitForQuery(action_max_timeout_ms())) {
94 ASSERT_TRUE(autocomplete_edit->GetAutocompleteMatches(&matches)); 96 ASSERT_TRUE(autocomplete_edit->GetAutocompleteMatches(&matches));
95 int64 time_elapsed = timer.Elapsed().InMilliseconds(); 97 int64 time_elapsed = timer.Elapsed().InMilliseconds();
96 98
97 // Adjust statistic trackers. 99 // Adjust statistic trackers.
98 if (query_count_ == 0) 100 if (query_count_ == 0)
99 time_min_ = time_max_ = time_elapsed; 101 time_min_ = time_max_ = time_elapsed;
100 ++query_count_; 102 ++query_count_;
101 time_squared_ += time_elapsed * time_elapsed; 103 time_squared_ += time_elapsed * time_elapsed;
102 time_sum_ += time_elapsed; 104 time_sum_ += time_elapsed;
103 if (time_elapsed < time_min_) 105 if (time_elapsed < time_min_)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 wprintf(L"__om_query_count = %d\n", query_count_); 172 wprintf(L"__om_query_count = %d\n", query_count_);
171 wprintf(L"__om_query_timeouts = %d\n", query_timeouts_); 173 wprintf(L"__om_query_timeouts = %d\n", query_timeouts_);
172 wprintf(L"__om_time_per_query_avg = %d\n", mean); 174 wprintf(L"__om_time_per_query_avg = %d\n", mean);
173 // Use the equation stddev = sqrt(Sum(x_i^2)/N - mean^2). 175 // 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>( 176 wprintf(L"__om_time_per_query_stddev = %d\n", static_cast<int64>(
175 sqrt(1.0 * time_squared_ / query_count_ - mean * mean))); 177 sqrt(1.0 * time_squared_ / query_count_ - mean * mean)));
176 wprintf(L"__om_time_per_query_max = %d\n", time_max_); 178 wprintf(L"__om_time_per_query_max = %d\n", time_max_);
177 wprintf(L"__om_time_per_query_min = %d\n", time_min_); 179 wprintf(L"__om_time_per_query_min = %d\n", time_min_);
178 wprintf(L"__om_score = %.4f\n", 100.0 * score_ / max_score_); 180 wprintf(L"__om_score = %.4f\n", 100.0 * score_ / max_score_);
179 } 181 }
OLDNEW
« no previous file with comments | « chrome/test/ui/mouseleave_uitest.cc ('k') | chrome/test/ui/v8_benchmark_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698