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_controller_impl.h" | 7 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
8 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 8 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
12 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
13 #include "components/autofill/browser/autofill_manager.h" | 13 #include "components/autofill/browser/autofill_manager.h" |
14 #include "components/autofill/browser/test_autofill_external_delegate.h" | 14 #include "components/autofill/browser/test_autofill_external_delegate.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
17 #include "content/public/test/test_utils.h" | 17 #include "content/public/test/test_utils.h" |
18 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
19 #include "ui/gfx/vector2d.h" | 19 #include "ui/gfx/vector2d.h" |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 class TestAutofillExternalDelegate : public AutofillExternalDelegate { | 23 class TestAutofillExternalDelegate : public AutofillExternalDelegate { |
24 public: | 24 public: |
25 TestAutofillExternalDelegate(content::WebContents* web_contents, | 25 TestAutofillExternalDelegate(content::WebContents* web_contents, |
26 AutofillManager* autofill_manager) | 26 AutofillManager* autofill_manager) |
27 : AutofillExternalDelegate(web_contents, autofill_manager), | 27 : AutofillExternalDelegate(web_contents, autofill_manager), |
28 popup_hidden_(true) {} | 28 popup_hidden_(true) {} |
29 ~TestAutofillExternalDelegate() {} | 29 virtual ~TestAutofillExternalDelegate() {} |
30 | 30 |
31 virtual void OnPopupShown(content::KeyboardListener* listener) OVERRIDE { | 31 virtual void OnPopupShown(content::KeyboardListener* listener) OVERRIDE { |
32 popup_hidden_ = false; | 32 popup_hidden_ = false; |
33 | 33 |
34 AutofillExternalDelegate::OnPopupShown(listener); | 34 AutofillExternalDelegate::OnPopupShown(listener); |
35 } | 35 } |
36 | 36 |
37 virtual void OnPopupHidden(content::KeyboardListener* listener) OVERRIDE { | 37 virtual void OnPopupHidden(content::KeyboardListener* listener) OVERRIDE { |
38 popup_hidden_ = true; | 38 popup_hidden_ = true; |
39 | 39 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 EXPECT_FALSE(autofill_external_delegate_->popup_hidden()); | 105 EXPECT_FALSE(autofill_external_delegate_->popup_hidden()); |
106 | 106 |
107 // Resize the window, which should cause the popup to hide. | 107 // Resize the window, which should cause the popup to hide. |
108 gfx::Rect new_bounds = browser()->window()->GetBounds() - gfx::Vector2d(1, 1); | 108 gfx::Rect new_bounds = browser()->window()->GetBounds() - gfx::Vector2d(1, 1); |
109 browser()->window()->SetBounds(new_bounds); | 109 browser()->window()->SetBounds(new_bounds); |
110 | 110 |
111 autofill_external_delegate_->WaitForPopupHidden(); | 111 autofill_external_delegate_->WaitForPopupHidden(); |
112 EXPECT_TRUE(autofill_external_delegate_->popup_hidden()); | 112 EXPECT_TRUE(autofill_external_delegate_->popup_hidden()); |
113 } | 113 } |
114 #endif // !defined(OS_MACOSX) | 114 #endif // !defined(OS_MACOSX) |
OLD | NEW |