| OLD | NEW |
| 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" |
| 11 #include "chrome/browser/api/infobars/infobar_tab_service.h" |
| 11 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" | 12 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
| 12 #include "chrome/browser/autofill/autofill_common_test.h" | 13 #include "chrome/browser/autofill/autofill_common_test.h" |
| 13 #include "chrome/browser/autofill/autofill_manager.h" | 14 #include "chrome/browser/autofill/autofill_manager.h" |
| 14 #include "chrome/browser/autofill/autofill_metrics.h" | 15 #include "chrome/browser/autofill/autofill_metrics.h" |
| 15 #include "chrome/browser/autofill/personal_data_manager.h" | 16 #include "chrome/browser/autofill/personal_data_manager.h" |
| 16 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 17 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 17 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 18 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 18 #include "chrome/browser/ui/tab_contents/test_tab_contents.h" | 19 #include "chrome/browser/ui/tab_contents/test_tab_contents.h" |
| 19 #include "chrome/browser/webdata/web_data_service.h" | 20 #include "chrome/browser/webdata/web_data_service.h" |
| 20 #include "chrome/test/base/testing_profile.h" | 21 #include "chrome/test/base/testing_profile.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 308 |
| 308 AutofillCCInfoBarDelegate* AutofillMetricsTest::CreateDelegate( | 309 AutofillCCInfoBarDelegate* AutofillMetricsTest::CreateDelegate( |
| 309 MockAutofillMetrics* metric_logger, | 310 MockAutofillMetrics* metric_logger, |
| 310 CreditCard** created_card) { | 311 CreditCard** created_card) { |
| 311 EXPECT_CALL(*metric_logger, | 312 EXPECT_CALL(*metric_logger, |
| 312 LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN)); | 313 LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN)); |
| 313 // The delegate created below will take ownership of this object. | 314 // The delegate created below will take ownership of this object. |
| 314 CreditCard* credit_card = new CreditCard(); | 315 CreditCard* credit_card = new CreditCard(); |
| 315 if (created_card) | 316 if (created_card) |
| 316 *created_card = credit_card; | 317 *created_card = credit_card; |
| 317 return new AutofillCCInfoBarDelegate(tab_contents()->infobar_tab_helper(), | 318 return new AutofillCCInfoBarDelegate( |
| 318 credit_card, | 319 InfoBarTabService::ForTab(tab_contents()), |
| 319 &personal_data_, | 320 credit_card, |
| 320 metric_logger); | 321 &personal_data_, |
| 322 metric_logger); |
| 321 } | 323 } |
| 322 | 324 |
| 323 // Test that we log quality metrics appropriately. | 325 // Test that we log quality metrics appropriately. |
| 324 TEST_F(AutofillMetricsTest, QualityMetrics) { | 326 TEST_F(AutofillMetricsTest, QualityMetrics) { |
| 325 // Set up our form data. | 327 // Set up our form data. |
| 326 FormData form; | 328 FormData form; |
| 327 form.name = ASCIIToUTF16("TestForm"); | 329 form.name = ASCIIToUTF16("TestForm"); |
| 328 form.method = ASCIIToUTF16("POST"); | 330 form.method = ASCIIToUTF16("POST"); |
| 329 form.origin = GURL("http://example.com/form.html"); | 331 form.origin = GURL("http://example.com/form.html"); |
| 330 form.action = GURL("http://example.com/submit.html"); | 332 form.action = GURL("http://example.com/submit.html"); |
| (...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1460 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), | 1462 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), |
| 1461 TimeTicks::FromInternalValue(3)); | 1463 TimeTicks::FromInternalValue(3)); |
| 1462 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); | 1464 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); |
| 1463 autofill_manager_->Reset(); | 1465 autofill_manager_->Reset(); |
| 1464 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); | 1466 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); |
| 1465 } | 1467 } |
| 1466 | 1468 |
| 1467 // Restore the global Gmock verbosity level to its default value. | 1469 // Restore the global Gmock verbosity level to its default value. |
| 1468 ::testing::FLAGS_gmock_verbose = "warning"; | 1470 ::testing::FLAGS_gmock_verbose = "warning"; |
| 1469 } | 1471 } |
| OLD | NEW |