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

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

Issue 9432029: GTK Keyboard Support for New Autofill (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixing switch case Created 8 years, 9 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
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/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
(...skipping 17 matching lines...) Expand all
28 public: 28 public:
29 MockAutofillExternalDelegate() : TestAutofillExternalDelegate(NULL, NULL) {} 29 MockAutofillExternalDelegate() : TestAutofillExternalDelegate(NULL, NULL) {}
30 ~MockAutofillExternalDelegate() {} 30 ~MockAutofillExternalDelegate() {}
31 31
32 virtual void SelectAutofillSuggestionAtIndex(int unique_id, int list_index) 32 virtual void SelectAutofillSuggestionAtIndex(int unique_id, int list_index)
33 OVERRIDE {} 33 OVERRIDE {}
34 }; 34 };
35 35
36 class TestAutofillPopupView : public AutofillPopupView { 36 class TestAutofillPopupView : public AutofillPopupView {
37 public: 37 public:
38 explicit TestAutofillPopupView( 38 TestAutofillPopupView(
39 content::WebContents* web_contents, 39 content::WebContents* web_contents,
40 AutofillExternalDelegate* autofill_external_delegate) 40 AutofillExternalDelegate* autofill_external_delegate)
41 : AutofillPopupView(web_contents, autofill_external_delegate) {} 41 : AutofillPopupView(web_contents, autofill_external_delegate) {}
42 virtual ~TestAutofillPopupView() {} 42 virtual ~TestAutofillPopupView() {}
43 43
44 MOCK_METHOD0(Hide, void()); 44 MOCK_METHOD0(Hide, void());
45 45
46 MOCK_METHOD1(InvalidateRow, void(size_t));
47
48 void SetSelectedLine(size_t selected_line) {
49 AutofillPopupView::SetSelectedLine(selected_line);
50 }
51
52 protected: 46 protected:
53 virtual void ShowInternal() OVERRIDE {} 47 virtual void ShowInternal() OVERRIDE {}
54 48
55 virtual void HideInternal() OVERRIDE {} 49 virtual void HideInternal() OVERRIDE {}
50
51 virtual void InvalidateRow(size_t row) OVERRIDE {}
56 }; 52 };
57 53
58 } // namespace 54 } // namespace
59 55
60 class AutofillPopupViewBrowserTest : public InProcessBrowserTest { 56 class AutofillPopupViewBrowserTest : public InProcessBrowserTest {
61 public: 57 public:
62 AutofillPopupViewBrowserTest() {} 58 AutofillPopupViewBrowserTest() {}
63 virtual ~AutofillPopupViewBrowserTest() {} 59 virtual ~AutofillPopupViewBrowserTest() {}
64 60
65 virtual void SetUpOnMainThread() OVERRIDE { 61 virtual void SetUpOnMainThread() OVERRIDE {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 browser()->OpenURL(content::OpenURLParams( 98 browser()->OpenURL(content::OpenURLParams(
103 GURL(chrome::kAboutBlankURL), content::Referrer(), 99 GURL(chrome::kAboutBlankURL), content::Referrer(),
104 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); 100 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
105 browser()->OpenURL(content::OpenURLParams( 101 browser()->OpenURL(content::OpenURLParams(
106 GURL(chrome::kChromeUIAboutURL), content::Referrer(), 102 GURL(chrome::kChromeUIAboutURL), content::Referrer(),
107 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); 103 CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
108 observer.Wait(); 104 observer.Wait();
109 105
110 // The mock verifies that the call was made. 106 // The mock verifies that the call was made.
111 } 107 }
112
113 IN_PROC_BROWSER_TEST_F(AutofillPopupViewBrowserTest,
114 SetSelectedAutofillLineAndCallInvalidate) {
115 std::vector<string16> autofill_values;
116 autofill_values.push_back(string16());
117 std::vector<int> autofill_ids;
118 autofill_ids.push_back(0);
119 autofill_popup_view_->Show(
120 autofill_values, autofill_values, autofill_values, autofill_ids, 0);
121
122 // Make sure that when a new line is selected, it is invalidated so it can
123 // be updated to show it is selected.
124 int selected_line = 0;
125 EXPECT_CALL(*autofill_popup_view_, InvalidateRow(selected_line));
126 autofill_popup_view_->SetSelectedLine(selected_line);
127
128 // Ensure that the row isn't invalidated if it didn't change.
129 EXPECT_CALL(*autofill_popup_view_, InvalidateRow(selected_line)).Times(0);
130 autofill_popup_view_->SetSelectedLine(selected_line);
131
132 // Change back to no selection.
133 EXPECT_CALL(*autofill_popup_view_, InvalidateRow(selected_line));
134 autofill_popup_view_->SetSelectedLine(-1);
135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698