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 "chrome/browser/ui/views/autofill/autofill_external_delegate_views.h" | 5 #include "chrome/browser/ui/views/autofill/autofill_external_delegate_views.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 8 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
9 #include "chrome/browser/ui/browser_tabstrip.h" | 9 #include "chrome/browser/ui/browser_tabstrip.h" |
10 #include "chrome/browser/ui/views/autofill/autofill_popup_view_views.h" | 10 #include "chrome/browser/ui/views/autofill/autofill_popup_view_views.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 virtual void SetUpOnMainThread() OVERRIDE { | 44 virtual void SetUpOnMainThread() OVERRIDE { |
45 tab_contents_ = chrome::GetActiveTabContents(browser()); | 45 tab_contents_ = chrome::GetActiveTabContents(browser()); |
46 ASSERT_TRUE(tab_contents_ != NULL); | 46 ASSERT_TRUE(tab_contents_ != NULL); |
47 | 47 |
48 autofill_external_delegate_.reset( | 48 autofill_external_delegate_.reset( |
49 new MockAutofillExternalDelegateViews(tab_contents_)); | 49 new MockAutofillExternalDelegateViews(tab_contents_)); |
50 } | 50 } |
51 | 51 |
52 void GeneratePopup() { | 52 void GeneratePopup() { |
53 int query_id = 1; | 53 int query_id = 1; |
54 webkit::forms::FormData form; | 54 FormData form; |
55 webkit::forms::FormField field; | 55 FormFieldData field; |
56 field.is_focusable = true; | 56 field.is_focusable = true; |
57 field.should_autocomplete = true; | 57 field.should_autocomplete = true; |
58 gfx::Rect bounds(100, 100); | 58 gfx::Rect bounds(100, 100); |
59 | 59 |
60 // Ensure that we can populate the popup through the delegate without any | 60 // Ensure that we can populate the popup through the delegate without any |
61 // and then close it. | 61 // and then close it. |
62 autofill_external_delegate_->OnQuery(query_id, form, field, bounds, false); | 62 autofill_external_delegate_->OnQuery(query_id, form, field, bounds, false); |
63 | 63 |
64 std::vector<string16> autofill_item; | 64 std::vector<string16> autofill_item; |
65 autofill_item.push_back(string16()); | 65 autofill_item.push_back(string16()); |
(...skipping 21 matching lines...) Expand all Loading... |
87 GeneratePopup(); | 87 GeneratePopup(); |
88 | 88 |
89 // Delete the widget to ensure that the external delegate can handle the | 89 // Delete the widget to ensure that the external delegate can handle the |
90 // popup getting deleted elsewhere and the . | 90 // popup getting deleted elsewhere and the . |
91 views::Widget* popup_widget = | 91 views::Widget* popup_widget = |
92 autofill_external_delegate_->popup_view()->GetWidget(); | 92 autofill_external_delegate_->popup_view()->GetWidget(); |
93 popup_widget->CloseNow(); | 93 popup_widget->CloseNow(); |
94 | 94 |
95 EXPECT_TRUE(autofill_external_delegate_->popup_hidden_); | 95 EXPECT_TRUE(autofill_external_delegate_->popup_hidden_); |
96 } | 96 } |
OLD | NEW |