Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: chrome/browser/autofill/autofill_popup_view_browsertest.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser/ui/browser_tabstrip.h"
10 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
11 #include "chrome/test/base/in_process_browser_test.h" 12 #include "chrome/test/base/in_process_browser_test.h"
12 #include "chrome/test/base/ui_test_utils.h" 13 #include "chrome/test/base/ui_test_utils.h"
13 #include "content/public/browser/navigation_controller.h" 14 #include "content/public/browser/navigation_controller.h"
14 #include "content/public/browser/notification_service.h" 15 #include "content/public/browser/notification_service.h"
15 #include "content/public/browser/notification_types.h" 16 #include "content/public/browser/notification_types.h"
16 #include "content/public/browser/page_navigator.h" 17 #include "content/public/browser/page_navigator.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 #include "content/public/common/url_constants.h" 19 #include "content/public/common/url_constants.h"
19 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 }; 55 };
55 56
56 } // namespace 57 } // namespace
57 58
58 class AutofillPopupViewBrowserTest : public InProcessBrowserTest { 59 class AutofillPopupViewBrowserTest : public InProcessBrowserTest {
59 public: 60 public:
60 AutofillPopupViewBrowserTest() {} 61 AutofillPopupViewBrowserTest() {}
61 virtual ~AutofillPopupViewBrowserTest() {} 62 virtual ~AutofillPopupViewBrowserTest() {}
62 63
63 virtual void SetUpOnMainThread() OVERRIDE { 64 virtual void SetUpOnMainThread() OVERRIDE {
64 web_contents_ = browser()->GetActiveWebContents(); 65 web_contents_ = chrome::GetActiveWebContents(browser());
65 ASSERT_TRUE(web_contents_ != NULL); 66 ASSERT_TRUE(web_contents_ != NULL);
66 67
67 autofill_popup_view_.reset(new TestAutofillPopupView( 68 autofill_popup_view_.reset(new TestAutofillPopupView(
68 web_contents_, 69 web_contents_,
69 &autofill_external_delegate_)); 70 &autofill_external_delegate_));
70 } 71 }
71 72
72 protected: 73 protected:
73 content::WebContents* web_contents_; 74 content::WebContents* web_contents_;
74 scoped_ptr<TestAutofillPopupView> autofill_popup_view_; 75 scoped_ptr<TestAutofillPopupView> autofill_popup_view_;
75 MockAutofillExternalDelegate autofill_external_delegate_; 76 MockAutofillExternalDelegate autofill_external_delegate_;
76 }; 77 };
77 78
78 IN_PROC_BROWSER_TEST_F(AutofillPopupViewBrowserTest, 79 IN_PROC_BROWSER_TEST_F(AutofillPopupViewBrowserTest,
79 SwitchTabAndHideAutofillPopup) { 80 SwitchTabAndHideAutofillPopup) {
80 EXPECT_CALL(*autofill_popup_view_, Hide()).Times(AtLeast(1)); 81 EXPECT_CALL(*autofill_popup_view_, Hide()).Times(AtLeast(1));
81 82
82 ui_test_utils::WindowedNotificationObserver observer( 83 ui_test_utils::WindowedNotificationObserver observer(
83 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, 84 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED,
84 content::Source<content::WebContents>(web_contents_)); 85 content::Source<content::WebContents>(web_contents_));
85 browser()->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), 86 chrome::AddSelectedTabWithURL(browser(), GURL(chrome::kAboutBlankURL),
86 content::PAGE_TRANSITION_START_PAGE); 87 content::PAGE_TRANSITION_START_PAGE);
87 observer.Wait(); 88 observer.Wait();
88 89
89 // The mock verifies that the call was made. 90 // The mock verifies that the call was made.
90 } 91 }
91 92
92 IN_PROC_BROWSER_TEST_F(AutofillPopupViewBrowserTest, 93 IN_PROC_BROWSER_TEST_F(AutofillPopupViewBrowserTest,
93 TestPageNavigationHidingAutofillPopup) { 94 TestPageNavigationHidingAutofillPopup) {
94 EXPECT_CALL(*autofill_popup_view_, Hide()).Times(AtLeast(1)); 95 EXPECT_CALL(*autofill_popup_view_, Hide()).Times(AtLeast(1));
95 96
96 ui_test_utils::WindowedNotificationObserver observer( 97 ui_test_utils::WindowedNotificationObserver observer(
97 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 98 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
98 content::Source<content::NavigationController>( 99 content::Source<content::NavigationController>(
99 &(web_contents_->GetController()))); 100 &(web_contents_->GetController())));
100 browser()->OpenURL(content::OpenURLParams( 101 browser()->OpenURL(content::OpenURLParams(
101 GURL(chrome::kAboutBlankURL), content::Referrer(), 102 GURL(chrome::kAboutBlankURL), content::Referrer(),
102 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); 103 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
103 browser()->OpenURL(content::OpenURLParams( 104 browser()->OpenURL(content::OpenURLParams(
104 GURL(chrome::kChromeUIAboutURL), content::Referrer(), 105 GURL(chrome::kChromeUIAboutURL), content::Referrer(),
105 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); 106 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
106 observer.Wait(); 107 observer.Wait();
107 108
108 // The mock verifies that the call was made. 109 // The mock verifies that the call was made.
109 } 110 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_browsertest.cc ('k') | chrome/browser/autofill/form_structure_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698