| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ref_counted.h" | 7 #include "base/ref_counted.h" |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/autofill/autofill_common_test.h" | 11 #include "chrome/browser/autofill/autofill_common_test.h" |
| 12 #include "chrome/browser/autofill/autofill_manager.h" | 12 #include "chrome/browser/autofill/autofill_manager.h" |
| 13 #include "chrome/browser/autofill/autofill_metrics.h" | 13 #include "chrome/browser/autofill/autofill_metrics.h" |
| 14 #include "chrome/browser/autofill/personal_data_manager.h" | 14 #include "chrome/browser/autofill/personal_data_manager.h" |
| 15 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | 15 #include "chrome/browser/renderer_host/test/test_render_view_host.h" |
| 16 #include "chrome/browser/tab_contents/test_tab_contents.h" | 16 #include "chrome/browser/tab_contents/test_tab_contents.h" |
| 17 #include "chrome/test/testing_browser_process.h" | |
| 18 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "webkit/glue/form_data.h" | 19 #include "webkit/glue/form_data.h" |
| 21 #include "webkit/glue/form_field.h" | 20 #include "webkit/glue/form_field.h" |
| 22 | 21 |
| 23 using webkit_glue::FormData; | 22 using webkit_glue::FormData; |
| 24 using webkit_glue::FormField; | 23 using webkit_glue::FormField; |
| 25 | 24 |
| 26 namespace { | 25 namespace { |
| 27 | 26 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 170 } |
| 172 | 171 |
| 173 virtual void SetUp() { | 172 virtual void SetUp() { |
| 174 RenderViewHostTestHarness::SetUp(); | 173 RenderViewHostTestHarness::SetUp(); |
| 175 test_personal_data_ = new TestPersonalDataManager(); | 174 test_personal_data_ = new TestPersonalDataManager(); |
| 176 autofill_manager_.reset(new TestAutoFillManager(contents(), | 175 autofill_manager_.reset(new TestAutoFillManager(contents(), |
| 177 test_personal_data_.get())); | 176 test_personal_data_.get())); |
| 178 } | 177 } |
| 179 | 178 |
| 180 protected: | 179 protected: |
| 181 ScopedTestingBrowserProcess browser_process_; | |
| 182 scoped_ptr<TestAutoFillManager> autofill_manager_; | 180 scoped_ptr<TestAutoFillManager> autofill_manager_; |
| 183 scoped_refptr<TestPersonalDataManager> test_personal_data_; | 181 scoped_refptr<TestPersonalDataManager> test_personal_data_; |
| 184 | 182 |
| 185 private: | 183 private: |
| 186 DISALLOW_COPY_AND_ASSIGN(AutoFillMetricsTest); | 184 DISALLOW_COPY_AND_ASSIGN(AutoFillMetricsTest); |
| 187 }; | 185 }; |
| 188 | 186 |
| 189 // Test that we log quality metrics appropriately. | 187 // Test that we log quality metrics appropriately. |
| 190 TEST_F(AutoFillMetricsTest, QualityMetrics) { | 188 TEST_F(AutoFillMetricsTest, QualityMetrics) { |
| 191 // Set up our form data. | 189 // Set up our form data. |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 EXPECT_CALL(*autofill_manager_->metric_logger(), | 531 EXPECT_CALL(*autofill_manager_->metric_logger(), |
| 534 Log(AutoFillMetrics::FIELD_SERVER_TYPE_UNKNOWN, experiment_id)); | 532 Log(AutoFillMetrics::FIELD_SERVER_TYPE_UNKNOWN, experiment_id)); |
| 535 EXPECT_CALL(*autofill_manager_->metric_logger(), | 533 EXPECT_CALL(*autofill_manager_->metric_logger(), |
| 536 Log(AutoFillMetrics::FIELD_SUBMITTED, experiment_id)); | 534 Log(AutoFillMetrics::FIELD_SUBMITTED, experiment_id)); |
| 537 EXPECT_CALL(*autofill_manager_->metric_logger(), | 535 EXPECT_CALL(*autofill_manager_->metric_logger(), |
| 538 Log(AutoFillMetrics::FIELD_SUBMITTED, experiment_id)); | 536 Log(AutoFillMetrics::FIELD_SUBMITTED, experiment_id)); |
| 539 | 537 |
| 540 // Simulate form submission. | 538 // Simulate form submission. |
| 541 EXPECT_NO_FATAL_FAILURE(autofill_manager_->OnFormSubmitted(form)); | 539 EXPECT_NO_FATAL_FAILURE(autofill_manager_->OnFormSubmitted(form)); |
| 542 } | 540 } |
| OLD | NEW |