| 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/autofill/autofill_manager.h" |
| 8 #include "chrome/browser/ui/browser_tabstrip.h" | 9 #include "chrome/browser/ui/browser_tabstrip.h" |
| 9 #include "chrome/browser/ui/views/autofill/autofill_popup_view_views.h" | 10 #include "chrome/browser/ui/views/autofill/autofill_popup_view_views.h" |
| 10 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
| 13 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 class MockAutofillExternalDelegateViews : public AutofillExternalDelegateViews { | 18 class MockAutofillExternalDelegateViews : public AutofillExternalDelegateViews { |
| 18 public: | 19 public: |
| 19 explicit MockAutofillExternalDelegateViews(content::WebContents* web_contents) | 20 explicit MockAutofillExternalDelegateViews(content::WebContents* web_contents) |
| 20 : AutofillExternalDelegateViews(web_contents, NULL), | 21 : AutofillExternalDelegateViews( |
| 22 web_contents, |
| 23 AutofillManager::FromWebContents(web_contents)), |
| 21 popup_hidden_(false) {} | 24 popup_hidden_(false) {} |
| 22 ~MockAutofillExternalDelegateViews() {} | 25 ~MockAutofillExternalDelegateViews() {} |
| 23 | 26 |
| 24 void HideAutofillPopupInternal() OVERRIDE { | 27 void HideAutofillPopupInternal() OVERRIDE { |
| 25 popup_hidden_ = true; | 28 popup_hidden_ = true; |
| 26 AutofillExternalDelegateViews::HideAutofillPopupInternal(); | 29 AutofillExternalDelegateViews::HideAutofillPopupInternal(); |
| 27 } | 30 } |
| 28 | 31 |
| 29 AutofillPopupViewViews* popup_view() { | 32 AutofillPopupViewViews* popup_view() { |
| 30 return AutofillExternalDelegateViews::popup_view(); | 33 return AutofillExternalDelegateViews::popup_view(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 GeneratePopup(); | 89 GeneratePopup(); |
| 87 | 90 |
| 88 // Delete the widget to ensure that the external delegate can handle the | 91 // Delete the widget to ensure that the external delegate can handle the |
| 89 // popup getting deleted elsewhere and the . | 92 // popup getting deleted elsewhere and the . |
| 90 views::Widget* popup_widget = | 93 views::Widget* popup_widget = |
| 91 autofill_external_delegate_->popup_view()->GetWidget(); | 94 autofill_external_delegate_->popup_view()->GetWidget(); |
| 92 popup_widget->CloseNow(); | 95 popup_widget->CloseNow(); |
| 93 | 96 |
| 94 EXPECT_TRUE(autofill_external_delegate_->popup_hidden_); | 97 EXPECT_TRUE(autofill_external_delegate_->popup_hidden_); |
| 95 } | 98 } |
| OLD | NEW |