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

Side by Side Diff: chrome/browser/autofill/autofill_metrics_unittest.cc

Issue 12091086: [Autofill] Add UMA timing metrics for requestAutocomplete dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase harder Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <vector> 5 #include <vector>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // AutofillManager is ref counted. 255 // AutofillManager is ref counted.
256 virtual ~TestAutofillManager() {} 256 virtual ~TestAutofillManager() {}
257 257
258 bool autofill_enabled_; 258 bool autofill_enabled_;
259 bool did_finish_async_form_submit_; 259 bool did_finish_async_form_submit_;
260 bool message_loop_is_running_; 260 bool message_loop_is_running_;
261 261
262 DISALLOW_COPY_AND_ASSIGN(TestAutofillManager); 262 DISALLOW_COPY_AND_ASSIGN(TestAutofillManager);
263 }; 263 };
264 264
265 class TestAutocheckoutManager : public AutocheckoutManager { 265 class TestAutocheckoutManager : public autofill::AutocheckoutManager {
266 public: 266 public:
267 explicit TestAutocheckoutManager(AutofillManager* autofill_manager) 267 explicit TestAutocheckoutManager(AutofillManager* autofill_manager)
268 : AutocheckoutManager(autofill_manager) { 268 : AutocheckoutManager(autofill_manager) {
269 } 269 }
270 270
271 virtual void ShowAutocheckoutDialog( 271 virtual void ShowAutocheckoutDialog(
272 const GURL& frame_url, 272 const GURL& frame_url,
273 const content::SSLStatus& ssl_status) OVERRIDE { 273 const content::SSLStatus& ssl_status) OVERRIDE {
274 // no-op. Just used as callback from autocheckout_infobar_delegate. 274 // no-op. Just used as callback from autocheckout_infobar_delegate.
275 } 275 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 328 }
329 329
330 void AutofillMetricsTest::SetUp() { 330 void AutofillMetricsTest::SetUp() {
331 TestingProfile* profile = new TestingProfile(); 331 TestingProfile* profile = new TestingProfile();
332 profile->CreateRequestContext(); 332 profile->CreateRequestContext();
333 browser_context_.reset(profile); 333 browser_context_.reset(profile);
334 PersonalDataManagerFactory::GetInstance()->SetTestingFactory(profile, NULL); 334 PersonalDataManagerFactory::GetInstance()->SetTestingFactory(profile, NULL);
335 335
336 ChromeRenderViewHostTestHarness::SetUp(); 336 ChromeRenderViewHostTestHarness::SetUp();
337 io_thread_.StartIOThread(); 337 io_thread_.StartIOThread();
338 TabAutofillManagerDelegate::CreateForWebContents(web_contents()); 338 autofill::TabAutofillManagerDelegate::CreateForWebContents(web_contents());
339 personal_data_.SetBrowserContext(profile); 339 personal_data_.SetBrowserContext(profile);
340 autofill_manager_ = new TestAutofillManager( 340 autofill_manager_ = new TestAutofillManager(
341 web_contents(), 341 web_contents(),
342 TabAutofillManagerDelegate::FromWebContents(web_contents()), 342 autofill::TabAutofillManagerDelegate::FromWebContents(web_contents()),
343 &personal_data_); 343 &personal_data_);
344 344
345 file_thread_.Start(); 345 file_thread_.Start();
346 346
347 // Ignore any metrics that we haven't explicitly set expectations for. 347 // Ignore any metrics that we haven't explicitly set expectations for.
348 // If we don't override the verbosity level, we'll get lots of log spew from 348 // If we don't override the verbosity level, we'll get lots of log spew from
349 // mocked functions that aren't relevant to a test but happen to be called 349 // mocked functions that aren't relevant to a test but happen to be called
350 // during the test's execution. 350 // during the test's execution.
351 // CAUTION: This is a global variable. So as to not affect other tests, this 351 // CAUTION: This is a global variable. So as to not affect other tests, this
352 // _must_ be restored to its original value at the end of the test. 352 // _must_ be restored to its original value at the end of the test.
(...skipping 29 matching lines...) Expand all
382 metric_logger); 382 metric_logger);
383 } 383 }
384 384
385 scoped_ptr<ConfirmInfoBarDelegate> 385 scoped_ptr<ConfirmInfoBarDelegate>
386 AutofillMetricsTest::CreateAutocheckoutDelegate( 386 AutofillMetricsTest::CreateAutocheckoutDelegate(
387 MockAutofillMetrics* metric_logger) { 387 MockAutofillMetrics* metric_logger) {
388 EXPECT_CALL(*metric_logger, 388 EXPECT_CALL(*metric_logger,
389 LogAutocheckoutInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN)); 389 LogAutocheckoutInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN));
390 GURL url("www.google.com"); 390 GURL url("www.google.com");
391 content::SSLStatus ssl_status; 391 content::SSLStatus ssl_status;
392 return AutocheckoutInfoBarDelegate::Create( 392 return autofill::AutocheckoutInfoBarDelegate::Create(
393 *metric_logger, 393 *metric_logger,
394 url, 394 url,
395 ssl_status, 395 ssl_status,
396 &autocheckout_manager_); 396 &autocheckout_manager_);
397 } 397 }
398 398
399 // Test that we log quality metrics appropriately. 399 // Test that we log quality metrics appropriately.
400 TEST_F(AutofillMetricsTest, QualityMetrics) { 400 TEST_F(AutofillMetricsTest, QualityMetrics) {
401 // Set up our form data. 401 // Set up our form data.
402 FormData form; 402 FormData form;
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1)); 1675 autofill_manager_->OnFormsSeen(forms, TimeTicks::FromInternalValue(1));
1676 autofill_manager_->OnDidFillAutofillFormData( 1676 autofill_manager_->OnDidFillAutofillFormData(
1677 TimeTicks::FromInternalValue(5)); 1677 TimeTicks::FromInternalValue(5));
1678 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), 1678 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(),
1679 TimeTicks::FromInternalValue(3)); 1679 TimeTicks::FromInternalValue(3));
1680 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); 1680 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17));
1681 autofill_manager_->Reset(); 1681 autofill_manager_->Reset();
1682 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 1682 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
1683 } 1683 }
1684 } 1684 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_metrics.cc ('k') | chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698