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

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: Response to review 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
« no previous file with comments | « no previous file | components/autofill/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" 9 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
10 #include "chrome/browser/ui/autofill/autofill_popup_view.h" 10 #include "chrome/browser/ui/autofill/autofill_popup_view.h"
11 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 11 #include "chrome/test/base/chrome_render_view_host_test_harness.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_common_test.h"
14 #include "components/autofill/core/browser/autofill_external_delegate.h" 15 #include "components/autofill/core/browser/autofill_external_delegate.h"
15 #include "components/autofill/core/browser/autofill_manager.h" 16 #include "components/autofill/core/browser/autofill_manager.h"
16 #include "components/autofill/core/browser/test_autofill_external_delegate.h" 17 #include "components/autofill/core/browser/test_autofill_external_delegate.h"
17 #include "components/autofill/core/browser/test_autofill_manager_delegate.h" 18 #include "components/autofill/core/browser/test_autofill_manager_delegate.h"
18 #include "grit/webkit_resources.h" 19 #include "grit/webkit_resources.h"
19 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 #include "third_party/WebKit/public/web/WebAutofillClient.h" 22 #include "third_party/WebKit/public/web/WebAutofillClient.h"
22 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/gfx/display.h" 24 #include "ui/gfx/display.h"
(...skipping 22 matching lines...) Expand all
46 {} 47 {}
47 virtual void ClearPreviewedForm() OVERRIDE {} 48 virtual void ClearPreviewedForm() OVERRIDE {}
48 base::WeakPtr<AutofillExternalDelegate> GetWeakPtr() { 49 base::WeakPtr<AutofillExternalDelegate> GetWeakPtr() {
49 return AutofillExternalDelegate::GetWeakPtr(); 50 return AutofillExternalDelegate::GetWeakPtr();
50 } 51 }
51 }; 52 };
52 53
53 class MockAutofillManagerDelegate 54 class MockAutofillManagerDelegate
54 : public autofill::TestAutofillManagerDelegate { 55 : public autofill::TestAutofillManagerDelegate {
55 public: 56 public:
56 MockAutofillManagerDelegate() {} 57 MockAutofillManagerDelegate()
58 : prefs_(autofill::test::PrefServiceForTesting()) {
59 }
57 virtual ~MockAutofillManagerDelegate() {} 60 virtual ~MockAutofillManagerDelegate() {}
58 61
59 virtual PrefService* GetPrefs() OVERRIDE { return &prefs_; } 62 virtual PrefService* GetPrefs() OVERRIDE { return prefs_.get(); }
60 63
61 private: 64 private:
62 TestingPrefServiceSimple prefs_; 65 scoped_ptr<PrefService> prefs_;
63 66
64 DISALLOW_COPY_AND_ASSIGN(MockAutofillManagerDelegate); 67 DISALLOW_COPY_AND_ASSIGN(MockAutofillManagerDelegate);
65 }; 68 };
66 69
67 class TestAutofillPopupController : public AutofillPopupControllerImpl { 70 class TestAutofillPopupController : public AutofillPopupControllerImpl {
68 public: 71 public:
69 explicit TestAutofillPopupController( 72 explicit TestAutofillPopupController(
70 base::WeakPtr<AutofillExternalDelegate> external_delegate, 73 base::WeakPtr<AutofillExternalDelegate> external_delegate,
71 const gfx::RectF& element_bounds) 74 const gfx::RectF& element_bounds)
72 : AutofillPopupControllerImpl( 75 : AutofillPopupControllerImpl(
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 EXPECT_EQ(expected_popup_bounds[i].ToString(), 605 EXPECT_EQ(expected_popup_bounds[i].ToString(),
603 autofill_popup_controller->popup_bounds().ToString()) << 606 autofill_popup_controller->popup_bounds().ToString()) <<
604 "Popup bounds failed to match for test " << i; 607 "Popup bounds failed to match for test " << i;
605 608
606 // Hide the controller to delete it. 609 // Hide the controller to delete it.
607 autofill_popup_controller->DoHide(); 610 autofill_popup_controller->DoHide();
608 } 611 }
609 } 612 }
610 613
611 } // namespace autofill 614 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698