OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 7 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
11 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
12 #include "components/autofill/browser/autofill_manager.h" | 12 #include "components/autofill/browser/autofill_manager.h" |
13 #include "components/autofill/browser/test_autofill_external_delegate.h" | 13 #include "components/autofill/browser/test_autofill_external_delegate.h" |
| 14 #include "components/autofill/content/browser/autofill_driver_impl.h" |
14 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
15 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
16 #include "content/public/test/test_utils.h" | 17 #include "content/public/test/test_utils.h" |
17 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
18 #include "ui/gfx/vector2d.h" | 19 #include "ui/gfx/vector2d.h" |
19 | 20 |
20 namespace autofill { | 21 namespace autofill { |
21 namespace { | 22 namespace { |
22 | 23 |
23 class TestAutofillExternalDelegate : public AutofillExternalDelegate { | 24 class TestAutofillExternalDelegate : public AutofillExternalDelegate { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 virtual ~AutofillPopupControllerBrowserTest() {} | 71 virtual ~AutofillPopupControllerBrowserTest() {} |
71 | 72 |
72 virtual void SetUpOnMainThread() OVERRIDE { | 73 virtual void SetUpOnMainThread() OVERRIDE { |
73 web_contents_ = browser()->tab_strip_model()->GetActiveWebContents(); | 74 web_contents_ = browser()->tab_strip_model()->GetActiveWebContents(); |
74 ASSERT_TRUE(web_contents_ != NULL); | 75 ASSERT_TRUE(web_contents_ != NULL); |
75 Observe(web_contents_); | 76 Observe(web_contents_); |
76 | 77 |
77 autofill_external_delegate_.reset( | 78 autofill_external_delegate_.reset( |
78 new TestAutofillExternalDelegate( | 79 new TestAutofillExternalDelegate( |
79 web_contents_, | 80 web_contents_, |
80 AutofillManager::FromWebContents(web_contents_))); | 81 AutofillDriverImpl::FromWebContents( |
| 82 web_contents_)->autofill_manager())); |
81 } | 83 } |
82 | 84 |
83 // Normally the WebContents will automatically delete the delegate, but here | 85 // Normally the WebContents will automatically delete the delegate, but here |
84 // the delegate is owned by this test, so we have to manually destroy. | 86 // the delegate is owned by this test, so we have to manually destroy. |
85 virtual void WebContentsDestroyed(content::WebContents* web_contents) | 87 virtual void WebContentsDestroyed(content::WebContents* web_contents) |
86 OVERRIDE { | 88 OVERRIDE { |
87 DCHECK_EQ(web_contents_, web_contents); | 89 DCHECK_EQ(web_contents_, web_contents); |
88 | 90 |
89 autofill_external_delegate_.reset(); | 91 autofill_external_delegate_.reset(); |
90 } | 92 } |
(...skipping 28 matching lines...) Expand all Loading... |
119 DeleteDelegateBeforePopupHidden){ | 121 DeleteDelegateBeforePopupHidden){ |
120 GenerateTestAutofillPopup(autofill_external_delegate_.get()); | 122 GenerateTestAutofillPopup(autofill_external_delegate_.get()); |
121 | 123 |
122 // Delete the external delegate here so that is gets deleted before popup is | 124 // Delete the external delegate here so that is gets deleted before popup is |
123 // hidden. This can happen if the web_contents are destroyed before the popup | 125 // hidden. This can happen if the web_contents are destroyed before the popup |
124 // is hidden. See http://crbug.com/232475 | 126 // is hidden. See http://crbug.com/232475 |
125 autofill_external_delegate_.reset(); | 127 autofill_external_delegate_.reset(); |
126 } | 128 } |
127 | 129 |
128 } // namespace autofill | 130 } // namespace autofill |
OLD | NEW |