| 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" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "webkit/glue/form_data.h" | 20 #include "webkit/glue/form_data.h" |
| 20 #include "webkit/glue/form_field.h" | 21 #include "webkit/glue/form_field.h" |
| 21 | 22 |
| 22 using webkit_glue::FormData; | 23 using webkit_glue::FormData; |
| 23 using webkit_glue::FormField; | 24 using webkit_glue::FormField; |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 171 } |
| 171 | 172 |
| 172 virtual void SetUp() { | 173 virtual void SetUp() { |
| 173 RenderViewHostTestHarness::SetUp(); | 174 RenderViewHostTestHarness::SetUp(); |
| 174 test_personal_data_ = new TestPersonalDataManager(); | 175 test_personal_data_ = new TestPersonalDataManager(); |
| 175 autofill_manager_.reset(new TestAutoFillManager(contents(), | 176 autofill_manager_.reset(new TestAutoFillManager(contents(), |
| 176 test_personal_data_.get())); | 177 test_personal_data_.get())); |
| 177 } | 178 } |
| 178 | 179 |
| 179 protected: | 180 protected: |
| 181 ScopedTestingBrowserProcess browser_process_; |
| 180 scoped_ptr<TestAutoFillManager> autofill_manager_; | 182 scoped_ptr<TestAutoFillManager> autofill_manager_; |
| 181 scoped_refptr<TestPersonalDataManager> test_personal_data_; | 183 scoped_refptr<TestPersonalDataManager> test_personal_data_; |
| 182 | 184 |
| 183 private: | 185 private: |
| 184 DISALLOW_COPY_AND_ASSIGN(AutoFillMetricsTest); | 186 DISALLOW_COPY_AND_ASSIGN(AutoFillMetricsTest); |
| 185 }; | 187 }; |
| 186 | 188 |
| 187 // Test that we log quality metrics appropriately. | 189 // Test that we log quality metrics appropriately. |
| 188 TEST_F(AutoFillMetricsTest, QualityMetrics) { | 190 TEST_F(AutoFillMetricsTest, QualityMetrics) { |
| 189 // Set up our form data. | 191 // Set up our form data. |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 EXPECT_CALL(*autofill_manager_->metric_logger(), | 533 EXPECT_CALL(*autofill_manager_->metric_logger(), |
| 532 Log(AutoFillMetrics::FIELD_SERVER_TYPE_UNKNOWN, experiment_id)); | 534 Log(AutoFillMetrics::FIELD_SERVER_TYPE_UNKNOWN, experiment_id)); |
| 533 EXPECT_CALL(*autofill_manager_->metric_logger(), | 535 EXPECT_CALL(*autofill_manager_->metric_logger(), |
| 534 Log(AutoFillMetrics::FIELD_SUBMITTED, experiment_id)); | 536 Log(AutoFillMetrics::FIELD_SUBMITTED, experiment_id)); |
| 535 EXPECT_CALL(*autofill_manager_->metric_logger(), | 537 EXPECT_CALL(*autofill_manager_->metric_logger(), |
| 536 Log(AutoFillMetrics::FIELD_SUBMITTED, experiment_id)); | 538 Log(AutoFillMetrics::FIELD_SUBMITTED, experiment_id)); |
| 537 | 539 |
| 538 // Simulate form submission. | 540 // Simulate form submission. |
| 539 EXPECT_NO_FATAL_FAILURE(autofill_manager_->OnFormSubmitted(form)); | 541 EXPECT_NO_FATAL_FAILURE(autofill_manager_->OnFormSubmitted(form)); |
| 540 } | 542 } |
| OLD | NEW |