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/autofill/autofill_popup_view.h" | 5 #include "chrome/browser/autofill/autofill_popup_view.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "chrome/browser/autofill/test_autofill_external_delegate.h" | 8 #include "chrome/browser/autofill/test_autofill_external_delegate.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 content::WebContents* web_contents_; | 73 content::WebContents* web_contents_; |
74 scoped_ptr<TestAutofillPopupView> autofill_popup_view_; | 74 scoped_ptr<TestAutofillPopupView> autofill_popup_view_; |
75 MockAutofillExternalDelegate autofill_external_delegate_; | 75 MockAutofillExternalDelegate autofill_external_delegate_; |
76 }; | 76 }; |
77 | 77 |
78 IN_PROC_BROWSER_TEST_F(AutofillPopupViewBrowserTest, | 78 IN_PROC_BROWSER_TEST_F(AutofillPopupViewBrowserTest, |
79 SwitchTabAndHideAutofillPopup) { | 79 SwitchTabAndHideAutofillPopup) { |
80 EXPECT_CALL(*autofill_popup_view_, Hide()).Times(AtLeast(1)); | 80 EXPECT_CALL(*autofill_popup_view_, Hide()).Times(AtLeast(1)); |
81 | 81 |
82 ui_test_utils::WindowedNotificationObserver observer( | 82 ui_test_utils::WindowedNotificationObserver observer( |
83 content::NOTIFICATION_WEB_CONTENTS_HIDDEN, | 83 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, |
84 content::Source<content::WebContents>(web_contents_)); | 84 content::Source<content::WebContents>(web_contents_)); |
85 browser()->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), | 85 browser()->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), |
86 content::PAGE_TRANSITION_START_PAGE); | 86 content::PAGE_TRANSITION_START_PAGE); |
87 observer.Wait(); | 87 observer.Wait(); |
88 | 88 |
89 // The mock verifies that the call was made. | 89 // The mock verifies that the call was made. |
90 } | 90 } |
91 | 91 |
92 IN_PROC_BROWSER_TEST_F(AutofillPopupViewBrowserTest, | 92 IN_PROC_BROWSER_TEST_F(AutofillPopupViewBrowserTest, |
93 TestPageNavigationHidingAutofillPopup) { | 93 TestPageNavigationHidingAutofillPopup) { |
94 EXPECT_CALL(*autofill_popup_view_, Hide()).Times(AtLeast(1)); | 94 EXPECT_CALL(*autofill_popup_view_, Hide()).Times(AtLeast(1)); |
95 | 95 |
96 ui_test_utils::WindowedNotificationObserver observer( | 96 ui_test_utils::WindowedNotificationObserver observer( |
97 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 97 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
98 content::Source<content::NavigationController>( | 98 content::Source<content::NavigationController>( |
99 &(web_contents_->GetController()))); | 99 &(web_contents_->GetController()))); |
100 browser()->OpenURL(content::OpenURLParams( | 100 browser()->OpenURL(content::OpenURLParams( |
101 GURL(chrome::kAboutBlankURL), content::Referrer(), | 101 GURL(chrome::kAboutBlankURL), content::Referrer(), |
102 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); | 102 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); |
103 browser()->OpenURL(content::OpenURLParams( | 103 browser()->OpenURL(content::OpenURLParams( |
104 GURL(chrome::kChromeUIAboutURL), content::Referrer(), | 104 GURL(chrome::kChromeUIAboutURL), content::Referrer(), |
105 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); | 105 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); |
106 observer.Wait(); | 106 observer.Wait(); |
107 | 107 |
108 // The mock verifies that the call was made. | 108 // The mock verifies that the call was made. |
109 } | 109 } |
OLD | NEW |