Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc

Issue 49303005: Parameterize the PrefService that AutofillDownloadManager uses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove extraneous diff Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/memory/weak_ptr.h" 6 #include "base/memory/weak_ptr.h"
7 #include "base/prefs/testing_pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" 8 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
10 #include "chrome/browser/ui/autofill/autofill_popup_view.h" 9 #include "chrome/browser/ui/autofill/autofill_popup_view.h"
11 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
11 #include "chrome/test/base/testing_pref_service_syncable.h"
12 #include "chrome/test/base/testing_profile.h" 12 #include "chrome/test/base/testing_profile.h"
13 #include "components/autofill/content/browser/autofill_driver_impl.h" 13 #include "components/autofill/content/browser/autofill_driver_impl.h"
14 #include "components/autofill/core/browser/autofill_external_delegate.h" 14 #include "components/autofill/core/browser/autofill_external_delegate.h"
15 #include "components/autofill/core/browser/autofill_manager.h" 15 #include "components/autofill/core/browser/autofill_manager.h"
16 #include "components/autofill/core/browser/test_autofill_external_delegate.h" 16 #include "components/autofill/core/browser/test_autofill_external_delegate.h"
17 #include "components/autofill/core/browser/test_autofill_manager_delegate.h" 17 #include "components/autofill/core/browser/test_autofill_manager_delegate.h"
18 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 #include "third_party/WebKit/public/web/WebAutofillClient.h" 20 #include "third_party/WebKit/public/web/WebAutofillClient.h"
21 #include "ui/gfx/display.h" 21 #include "ui/gfx/display.h"
(...skipping 27 matching lines...) Expand all
49 }; 49 };
50 50
51 class MockAutofillManagerDelegate 51 class MockAutofillManagerDelegate
52 : public autofill::TestAutofillManagerDelegate { 52 : public autofill::TestAutofillManagerDelegate {
53 public: 53 public:
54 MockAutofillManagerDelegate() {} 54 MockAutofillManagerDelegate() {}
55 virtual ~MockAutofillManagerDelegate() {} 55 virtual ~MockAutofillManagerDelegate() {}
56 56
57 virtual PrefService* GetPrefs() OVERRIDE { return &prefs_; } 57 virtual PrefService* GetPrefs() OVERRIDE { return &prefs_; }
58 58
59 user_prefs::PrefRegistrySyncable* GetPrefRegistry() {
60 return prefs_.registry();
61 }
62
59 private: 63 private:
60 TestingPrefServiceSimple prefs_; 64 TestingPrefServiceSyncable prefs_;
Ilya Sherman 2013/11/05 00:17:04 Hmm, why is this change needed here, but not for t
blundell 2013/11/05 15:26:54 It's needed here because this test is using a manu
61 65
62 DISALLOW_COPY_AND_ASSIGN(MockAutofillManagerDelegate); 66 DISALLOW_COPY_AND_ASSIGN(MockAutofillManagerDelegate);
63 }; 67 };
64 68
65 class TestAutofillPopupController : public AutofillPopupControllerImpl { 69 class TestAutofillPopupController : public AutofillPopupControllerImpl {
66 public: 70 public:
67 explicit TestAutofillPopupController( 71 explicit TestAutofillPopupController(
68 base::WeakPtr<AutofillExternalDelegate> external_delegate, 72 base::WeakPtr<AutofillExternalDelegate> external_delegate,
69 const gfx::RectF& element_bounds) 73 const gfx::RectF& element_bounds)
70 : AutofillPopupControllerImpl( 74 : AutofillPopupControllerImpl(
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 class AutofillPopupControllerUnitTest : public ChromeRenderViewHostTestHarness { 124 class AutofillPopupControllerUnitTest : public ChromeRenderViewHostTestHarness {
121 public: 125 public:
122 AutofillPopupControllerUnitTest() 126 AutofillPopupControllerUnitTest()
123 : manager_delegate_(new MockAutofillManagerDelegate()), 127 : manager_delegate_(new MockAutofillManagerDelegate()),
124 autofill_popup_controller_(NULL) {} 128 autofill_popup_controller_(NULL) {}
125 virtual ~AutofillPopupControllerUnitTest() {} 129 virtual ~AutofillPopupControllerUnitTest() {}
126 130
127 virtual void SetUp() OVERRIDE { 131 virtual void SetUp() OVERRIDE {
128 ChromeRenderViewHostTestHarness::SetUp(); 132 ChromeRenderViewHostTestHarness::SetUp();
129 133
134 AutofillManager::RegisterProfilePrefs(manager_delegate_->GetPrefRegistry());
135
130 AutofillDriverImpl::CreateForWebContentsAndDelegate( 136 AutofillDriverImpl::CreateForWebContentsAndDelegate(
131 web_contents(), 137 web_contents(),
132 manager_delegate_.get(), 138 manager_delegate_.get(),
133 "en-US", 139 "en-US",
134 AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER); 140 AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER);
135 AutofillDriverImpl* driver = 141 AutofillDriverImpl* driver =
136 AutofillDriverImpl::FromWebContents(web_contents()); 142 AutofillDriverImpl::FromWebContents(web_contents());
137 external_delegate_.reset( 143 external_delegate_.reset(
138 new NiceMock<MockAutofillExternalDelegate>( 144 new NiceMock<MockAutofillExternalDelegate>(
139 web_contents(), 145 web_contents(),
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 EXPECT_EQ(expected_popup_bounds[i].ToString(), 604 EXPECT_EQ(expected_popup_bounds[i].ToString(),
599 autofill_popup_controller->popup_bounds().ToString()) << 605 autofill_popup_controller->popup_bounds().ToString()) <<
600 "Popup bounds failed to match for test " << i; 606 "Popup bounds failed to match for test " << i;
601 607
602 // Hide the controller to delete it. 608 // Hide the controller to delete it.
603 autofill_popup_controller->DoHide(); 609 autofill_popup_controller->DoHide();
604 } 610 }
605 } 611 }
606 612
607 } // namespace autofill 613 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/DEPS » ('j') | components/autofill/core/browser/autofill_download.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698