| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <memory> |
| 6 |
| 5 #include "base/macros.h" | 7 #include "base/macros.h" |
| 6 #include "base/memory/scoped_ptr.h" | |
| 7 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 8 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 9 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
| 9 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
| 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 12 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
| 13 #include "components/autofill/content/browser/content_autofill_driver.h" | 14 #include "components/autofill/content/browser/content_autofill_driver.h" |
| 14 #include "components/autofill/content/browser/content_autofill_driver_factory.h" | 15 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
| 15 #include "components/autofill/core/browser/autofill_manager.h" | 16 #include "components/autofill/core/browser/autofill_manager.h" |
| 16 #include "components/autofill/core/browser/test_autofill_external_delegate.h" | 17 #include "components/autofill/core/browser/test_autofill_external_delegate.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 90 } |
| 90 | 91 |
| 91 // Normally the WebContents will automatically delete the delegate, but here | 92 // Normally the WebContents will automatically delete the delegate, but here |
| 92 // the delegate is owned by this test, so we have to manually destroy. | 93 // the delegate is owned by this test, so we have to manually destroy. |
| 93 void RenderFrameDeleted(content::RenderFrameHost* rfh) override { | 94 void RenderFrameDeleted(content::RenderFrameHost* rfh) override { |
| 94 if (!rfh->GetParent()) | 95 if (!rfh->GetParent()) |
| 95 autofill_external_delegate_.reset(); | 96 autofill_external_delegate_.reset(); |
| 96 } | 97 } |
| 97 | 98 |
| 98 protected: | 99 protected: |
| 99 scoped_ptr<TestAutofillExternalDelegate> autofill_external_delegate_; | 100 std::unique_ptr<TestAutofillExternalDelegate> autofill_external_delegate_; |
| 100 }; | 101 }; |
| 101 | 102 |
| 102 #if defined(OS_MACOSX) | 103 #if defined(OS_MACOSX) |
| 103 // Fails on Mac OS. http://crbug.com/453256 | 104 // Fails on Mac OS. http://crbug.com/453256 |
| 104 #define MAYBE_HidePopupOnWindowMove DISABLED_HidePopupOnWindowMove | 105 #define MAYBE_HidePopupOnWindowMove DISABLED_HidePopupOnWindowMove |
| 105 #else | 106 #else |
| 106 #define MAYBE_HidePopupOnWindowMove HidePopupOnWindowMove | 107 #define MAYBE_HidePopupOnWindowMove HidePopupOnWindowMove |
| 107 #endif | 108 #endif |
| 108 IN_PROC_BROWSER_TEST_F(AutofillPopupControllerBrowserTest, | 109 IN_PROC_BROWSER_TEST_F(AutofillPopupControllerBrowserTest, |
| 109 MAYBE_HidePopupOnWindowMove) { | 110 MAYBE_HidePopupOnWindowMove) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 140 DeleteDelegateBeforePopupHidden){ | 141 DeleteDelegateBeforePopupHidden){ |
| 141 GenerateTestAutofillPopup(autofill_external_delegate_.get()); | 142 GenerateTestAutofillPopup(autofill_external_delegate_.get()); |
| 142 | 143 |
| 143 // Delete the external delegate here so that is gets deleted before popup is | 144 // Delete the external delegate here so that is gets deleted before popup is |
| 144 // hidden. This can happen if the web_contents are destroyed before the popup | 145 // hidden. This can happen if the web_contents are destroyed before the popup |
| 145 // is hidden. See http://crbug.com/232475 | 146 // is hidden. See http://crbug.com/232475 |
| 146 autofill_external_delegate_.reset(); | 147 autofill_external_delegate_.reset(); |
| 147 } | 148 } |
| 148 | 149 |
| 149 } // namespace autofill | 150 } // namespace autofill |
| OLD | NEW |