OLD | NEW |
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 "chrome/browser/autofill/autofill_manager.h" | 6 #include "chrome/browser/autofill/autofill_manager.h" |
7 #include "chrome/browser/autofill/test_autofill_external_delegate.h" | 7 #include "chrome/browser/autofill/test_autofill_external_delegate.h" |
8 #include "chrome/browser/autofill/test_autofill_manager_delegate.h" | 8 #include "chrome/browser/autofill/test_autofill_manager_delegate.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_tabstrip.h" | 10 #include "chrome/browser/ui/browser_tabstrip.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "content/public/test/test_utils.h" | 21 #include "content/public/test/test_utils.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
24 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 class MockAutofillManagerDelegate | 28 class MockAutofillManagerDelegate |
29 : public autofill::TestAutofillManagerDelegate { | 29 : public autofill::TestAutofillManagerDelegate { |
30 public: | 30 public: |
| 31 MockAutofillManagerDelegate() {} |
| 32 virtual ~MockAutofillManagerDelegate() {} |
| 33 |
31 virtual PrefService* GetPrefs() { return &prefs_; } | 34 virtual PrefService* GetPrefs() { return &prefs_; } |
32 | 35 |
33 PrefRegistrySyncable* GetPrefRegistry() { | 36 PrefRegistrySyncable* GetPrefRegistry() { |
34 return prefs_.registry(); | 37 return prefs_.registry(); |
35 } | 38 } |
36 | 39 |
37 MOCK_METHOD6(ShowAutofillPopup, | 40 MOCK_METHOD6(ShowAutofillPopup, |
38 void(const gfx::RectF& element_bounds, | 41 void(const gfx::RectF& element_bounds, |
39 const std::vector<string16>& values, | 42 const std::vector<string16>& values, |
40 const std::vector<string16>& labels, | 43 const std::vector<string16>& labels, |
41 const std::vector<string16>& icons, | 44 const std::vector<string16>& icons, |
42 const std::vector<int>& identifiers, | 45 const std::vector<int>& identifiers, |
43 AutofillPopupDelegate* delegate)); | 46 AutofillPopupDelegate* delegate)); |
44 | 47 |
45 MOCK_METHOD0(HideAutofillPopup, void()); | 48 MOCK_METHOD0(HideAutofillPopup, void()); |
46 | 49 |
47 private: | 50 private: |
48 TestingPrefServiceSyncable prefs_; | 51 TestingPrefServiceSyncable prefs_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(MockAutofillManagerDelegate); |
49 }; | 54 }; |
50 | 55 |
51 // Subclass AutofillManager so we can create AutofillManager instance. | 56 // Subclass AutofillManager so we can create AutofillManager instance. |
52 class TestAutofillManager : public AutofillManager { | 57 class TestAutofillManager : public AutofillManager { |
53 public: | 58 public: |
54 TestAutofillManager(content::WebContents* web_contents, | 59 TestAutofillManager(content::WebContents* web_contents, |
55 autofill::AutofillManagerDelegate* delegate) | 60 autofill::AutofillManagerDelegate* delegate) |
56 : AutofillManager(web_contents, delegate) {} | 61 : AutofillManager(web_contents, delegate) {} |
57 virtual ~TestAutofillManager() {} | 62 virtual ~TestAutofillManager() {} |
58 | 63 |
59 private: | 64 private: |
60 DISALLOW_COPY_AND_ASSIGN(TestAutofillManager); | 65 DISALLOW_COPY_AND_ASSIGN(TestAutofillManager); |
61 }; | 66 }; |
62 | 67 |
| 68 // Subclass AutofillExternalDelegate so we can create an |
| 69 // AutofillExternalDelegate instance. |
63 class TestAutofillExternalDelegate : public AutofillExternalDelegate { | 70 class TestAutofillExternalDelegate : public AutofillExternalDelegate { |
64 public: | 71 public: |
65 TestAutofillExternalDelegate(content::WebContents* web_contents, | 72 TestAutofillExternalDelegate(content::WebContents* web_contents, |
66 AutofillManager* autofill_manager) | 73 AutofillManager* autofill_manager) |
67 : AutofillExternalDelegate(web_contents, autofill_manager) {} | 74 : AutofillExternalDelegate(web_contents, autofill_manager) {} |
68 ~TestAutofillExternalDelegate() {} | 75 ~TestAutofillExternalDelegate() {} |
69 }; | 76 }; |
70 | 77 |
71 } // namespace | 78 } // namespace |
72 | 79 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 content::Source<content::NavigationController>( | 146 content::Source<content::NavigationController>( |
140 &(web_contents_->GetController()))); | 147 &(web_contents_->GetController()))); |
141 browser()->OpenURL(content::OpenURLParams( | 148 browser()->OpenURL(content::OpenURLParams( |
142 GURL(chrome::kChromeUIBookmarksURL), content::Referrer(), | 149 GURL(chrome::kChromeUIBookmarksURL), content::Referrer(), |
143 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); | 150 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); |
144 browser()->OpenURL(content::OpenURLParams( | 151 browser()->OpenURL(content::OpenURLParams( |
145 GURL(chrome::kChromeUIAboutURL), content::Referrer(), | 152 GURL(chrome::kChromeUIAboutURL), content::Referrer(), |
146 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); | 153 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); |
147 observer.Wait(); | 154 observer.Wait(); |
148 } | 155 } |
OLD | NEW |