| 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/string16.h" | 8 #include "base/string16.h" |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/autocomplete_history_manager.h" | 11 #include "chrome/browser/autocomplete_history_manager.h" |
| 12 #include "chrome/browser/webdata/web_data_service.h" | 12 #include "chrome/browser/webdata/web_data_service.h" |
| 13 #include "chrome/test/testing_browser_process.h" |
| 14 #include "chrome/test/testing_browser_process_test.h" |
| 13 #include "chrome/test/testing_profile.h" | 15 #include "chrome/test/testing_profile.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "webkit/glue/form_data.h" | 18 #include "webkit/glue/form_data.h" |
| 17 | 19 |
| 18 using testing::_; | 20 using testing::_; |
| 19 using webkit_glue::FormData; | 21 using webkit_glue::FormData; |
| 20 | 22 |
| 21 class MockWebDataService : public WebDataService { | 23 class MockWebDataService : public WebDataService { |
| 22 public: | 24 public: |
| 23 MOCK_METHOD1(AddFormFields, | 25 MOCK_METHOD1(AddFormFields, |
| 24 void(const std::vector<webkit_glue::FormField>&)); // NOLINT | 26 void(const std::vector<webkit_glue::FormField>&)); // NOLINT |
| 25 }; | 27 }; |
| 26 | 28 |
| 27 class AutocompleteHistoryManagerTest : public testing::Test { | 29 class AutocompleteHistoryManagerTest : public TestingBrowserProcessTest { |
| 28 protected: | 30 protected: |
| 29 AutocompleteHistoryManagerTest() | 31 AutocompleteHistoryManagerTest() |
| 30 : ui_thread_(BrowserThread::UI, &message_loop_) { | 32 : ui_thread_(BrowserThread::UI, &message_loop_) { |
| 31 } | 33 } |
| 32 | 34 |
| 33 virtual void SetUp() { | 35 virtual void SetUp() { |
| 34 web_data_service_ = new MockWebDataService(); | 36 web_data_service_ = new MockWebDataService(); |
| 35 autocomplete_manager_.reset( | 37 autocomplete_manager_.reset( |
| 36 new AutocompleteHistoryManager(&profile_, web_data_service_)); | 38 new AutocompleteHistoryManager(&profile_, web_data_service_)); |
| 37 } | 39 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 ASCIIToUTF16("ssn"), | 105 ASCIIToUTF16("ssn"), |
| 104 ASCIIToUTF16("078-05-1120"), | 106 ASCIIToUTF16("078-05-1120"), |
| 105 ASCIIToUTF16("text"), | 107 ASCIIToUTF16("text"), |
| 106 20, | 108 20, |
| 107 false); | 109 false); |
| 108 form.fields.push_back(ssn); | 110 form.fields.push_back(ssn); |
| 109 | 111 |
| 110 EXPECT_CALL(*web_data_service_, AddFormFields(_)).Times(0); | 112 EXPECT_CALL(*web_data_service_, AddFormFields(_)).Times(0); |
| 111 autocomplete_manager_->OnFormSubmitted(form); | 113 autocomplete_manager_->OnFormSubmitted(form); |
| 112 } | 114 } |
| OLD | NEW |