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

Side by Side Diff: chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc

Issue 12223106: Properly Remove Autofill Keyboard Listener. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 10 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 "base/memory/weak_ptr.h" 5 #include "base/memory/weak_ptr.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/autofill/test_autofill_external_delegate.h" 7 #include "chrome/browser/autofill/test_autofill_external_delegate.h"
8 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" 8 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 216
217 // Remove the first entry. The popup should be redrawn since its size has 217 // Remove the first entry. The popup should be redrawn since its size has
218 // changed. 218 // changed.
219 EXPECT_CALL(*autofill_popup_controller_, UpdateBoundsAndRedrawPopup()); 219 EXPECT_CALL(*autofill_popup_controller_, UpdateBoundsAndRedrawPopup());
220 autofill_popup_controller_->SetSelectedLine(0); 220 autofill_popup_controller_->SetSelectedLine(0);
221 EXPECT_TRUE(autofill_popup_controller_->RemoveSelectedLine()); 221 EXPECT_TRUE(autofill_popup_controller_->RemoveSelectedLine());
222 222
223 // Remove the last entry. The popup should then be hidden since there are 223 // Remove the last entry. The popup should then be hidden since there are
224 // no Autofill entries left. 224 // no Autofill entries left.
225 autofill_popup_controller_->SetSelectedLine(0); 225 autofill_popup_controller_->SetSelectedLine(0);
226 // The controller self-deletes here, don't double delete.
227 EXPECT_TRUE(autofill_popup_controller_->RemoveSelectedLine()); 226 EXPECT_TRUE(autofill_popup_controller_->RemoveSelectedLine());
228 autofill_popup_controller_ = NULL;
229 } 227 }
230 228
231 TEST_F(AutofillPopupControllerUnitTest, SkipSeparator) { 229 TEST_F(AutofillPopupControllerUnitTest, SkipSeparator) {
232 // Set up the popup. 230 // Set up the popup.
233 std::vector<string16> names(3, string16()); 231 std::vector<string16> names(3, string16());
234 std::vector<int> autofill_ids; 232 std::vector<int> autofill_ids;
235 autofill_ids.push_back(1); 233 autofill_ids.push_back(1);
236 autofill_ids.push_back(WebAutofillClient::MenuItemIDSeparator); 234 autofill_ids.push_back(WebAutofillClient::MenuItemIDSeparator);
237 autofill_ids.push_back(WebAutofillClient::MenuItemIDAutofillOptions); 235 autofill_ids.push_back(WebAutofillClient::MenuItemIDAutofillOptions);
238 autofill_popup_controller_->Show(names, names, names, autofill_ids); 236 autofill_popup_controller_->Show(names, names, names, autofill_ids);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 autofill_popup_controller->Show(names, names, names, autofill_ids); 384 autofill_popup_controller->Show(names, names, names, autofill_ids);
387 385
388 EXPECT_EQ(expected_popup_bounds[i].ToString(), 386 EXPECT_EQ(expected_popup_bounds[i].ToString(),
389 autofill_popup_controller->popup_bounds().ToString()) << 387 autofill_popup_controller->popup_bounds().ToString()) <<
390 "Popup bounds failed to match for test " << i; 388 "Popup bounds failed to match for test " << i;
391 389
392 // Hide the controller to delete it. 390 // Hide the controller to delete it.
393 autofill_popup_controller->DoHide(); 391 autofill_popup_controller->DoHide();
394 } 392 }
395 } 393 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_popup_controller_impl.cc ('k') | content/browser/renderer_host/render_widget_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698