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/api/infobars/infobar_service.h" |
12 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" | 12 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
13 #include "chrome/browser/autofill/autofill_common_test.h" | 13 #include "chrome/browser/autofill/autofill_common_test.h" |
14 #include "chrome/browser/autofill/autofill_manager.h" | 14 #include "chrome/browser/autofill/autofill_manager.h" |
15 #include "chrome/browser/autofill/autofill_metrics.h" | 15 #include "chrome/browser/autofill/autofill_metrics.h" |
16 #include "chrome/browser/autofill/personal_data_manager.h" | 16 #include "chrome/browser/autofill/personal_data_manager.h" |
17 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 17 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
18 #include "chrome/browser/ui/tab_contents/tab_autofill_manager_delegate.h" | 18 #include "chrome/browser/ui/tab_contents/tab_autofill_manager_delegate.h" |
19 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 19 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
20 #include "chrome/browser/ui/tab_contents/test_tab_contents.h" | 20 #include "chrome/browser/ui/tab_contents/test_tab_contents.h" |
21 #include "chrome/browser/webdata/web_data_service.h" | 21 #include "chrome/browser/webdata/web_data_service.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 AutofillCCInfoBarDelegate* AutofillMetricsTest::CreateDelegate( | 313 AutofillCCInfoBarDelegate* AutofillMetricsTest::CreateDelegate( |
314 MockAutofillMetrics* metric_logger, | 314 MockAutofillMetrics* metric_logger, |
315 CreditCard** created_card) { | 315 CreditCard** created_card) { |
316 EXPECT_CALL(*metric_logger, | 316 EXPECT_CALL(*metric_logger, |
317 LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN)); | 317 LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN)); |
318 // The delegate created below will take ownership of this object. | 318 // The delegate created below will take ownership of this object. |
319 CreditCard* credit_card = new CreditCard(); | 319 CreditCard* credit_card = new CreditCard(); |
320 if (created_card) | 320 if (created_card) |
321 *created_card = credit_card; | 321 *created_card = credit_card; |
322 return new AutofillCCInfoBarDelegate( | 322 return new AutofillCCInfoBarDelegate( |
323 InfoBarTabService::ForTab(tab_contents()), | 323 InfoBarService::ForTab(tab_contents()), |
324 credit_card, | 324 credit_card, |
325 &personal_data_, | 325 &personal_data_, |
326 metric_logger); | 326 metric_logger); |
327 } | 327 } |
328 | 328 |
329 // Test that we log quality metrics appropriately. | 329 // Test that we log quality metrics appropriately. |
330 TEST_F(AutofillMetricsTest, QualityMetrics) { | 330 TEST_F(AutofillMetricsTest, QualityMetrics) { |
331 // Set up our form data. | 331 // Set up our form data. |
332 FormData form; | 332 FormData form; |
333 form.name = ASCIIToUTF16("TestForm"); | 333 form.name = ASCIIToUTF16("TestForm"); |
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), | 1466 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), |
1467 TimeTicks::FromInternalValue(3)); | 1467 TimeTicks::FromInternalValue(3)); |
1468 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); | 1468 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); |
1469 autofill_manager_->Reset(); | 1469 autofill_manager_->Reset(); |
1470 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); | 1470 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); |
1471 } | 1471 } |
1472 | 1472 |
1473 // Restore the global Gmock verbosity level to its default value. | 1473 // Restore the global Gmock verbosity level to its default value. |
1474 ::testing::FLAGS_gmock_verbose = "warning"; | 1474 ::testing::FLAGS_gmock_verbose = "warning"; |
1475 } | 1475 } |
OLD | NEW |