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

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

Issue 12188020: Adding the page and DPI scale adjustment for Autofill Popups. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing Autofill unittests 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 | 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 bool RemoveSelectedLine() { 70 bool RemoveSelectedLine() {
71 return AutofillPopupControllerImpl::RemoveSelectedLine(); 71 return AutofillPopupControllerImpl::RemoveSelectedLine();
72 } 72 }
73 void DoHide() { 73 void DoHide() {
74 AutofillPopupControllerImpl::Hide(); 74 AutofillPopupControllerImpl::Hide();
75 } 75 }
76 const gfx::Rect& popup_bounds() const { 76 const gfx::Rect& popup_bounds() const {
77 return AutofillPopupControllerImpl::popup_bounds(); 77 return AutofillPopupControllerImpl::popup_bounds();
78 } 78 }
79 const gfx::Rect& element_bounds() const { 79 const gfx::Rect rounded_element_bounds() const {
80 return AutofillPopupControllerImpl::element_bounds(); 80 return AutofillPopupControllerImpl::rounded_element_bounds();
81 } 81 }
82 #if !defined(OS_ANDROID) 82 #if !defined(OS_ANDROID)
83 const gfx::Font& name_font() const { 83 const gfx::Font& name_font() const {
84 return AutofillPopupControllerImpl::name_font(); 84 return AutofillPopupControllerImpl::name_font();
85 } 85 }
86 const gfx::Font& subtext_font() const { 86 const gfx::Font& subtext_font() const {
87 return AutofillPopupControllerImpl::subtext_font(); 87 return AutofillPopupControllerImpl::subtext_font();
88 } 88 }
89 #endif 89 #endif
90 int GetDesiredPopupWidth() const { 90 int GetDesiredPopupWidth() const {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 NULL, 273 NULL,
274 gfx::Rect()); 274 gfx::Rect());
275 EXPECT_EQ(controller, controller2); 275 EXPECT_EQ(controller, controller2);
276 controller->Hide(); 276 controller->Hide();
277 277
278 testing::NiceMock<TestAutofillPopupController>* test_controller = 278 testing::NiceMock<TestAutofillPopupController>* test_controller =
279 new testing::NiceMock<TestAutofillPopupController>(&delegate, 279 new testing::NiceMock<TestAutofillPopupController>(&delegate,
280 gfx::Rect()); 280 gfx::Rect());
281 EXPECT_CALL(*test_controller, Hide()); 281 EXPECT_CALL(*test_controller, Hide());
282 282
283 gfx::Rect bounds(0, 0, 1, 2); 283 gfx::Rect bounds(0, 0, 1, 2);
Ilya Sherman 2013/02/05 02:27:53 This should be a gfx::RectF, right?
aurimas (slooooooooow) 2013/02/06 00:05:27 I only changed for element_bounds to use RectF. Po
Ilya Sherman 2013/02/06 00:07:40 These bounds *are* element bounds, and you updated
284 AutofillPopupControllerImpl* controller3 = 284 AutofillPopupControllerImpl* controller3 =
285 AutofillPopupControllerImpl::GetOrCreate( 285 AutofillPopupControllerImpl::GetOrCreate(
286 test_controller, 286 test_controller,
287 &delegate, 287 &delegate,
288 NULL, 288 NULL,
289 bounds); 289 bounds);
290 EXPECT_EQ( 290 EXPECT_EQ(
291 bounds, 291 bounds,
292 static_cast<AutofillPopupController*>(controller3)->element_bounds()); 292 static_cast<AutofillPopupController*>(controller3)->rounded_element_bounds ());
293 controller3->Hide(); 293 controller3->Hide();
294 294
295 EXPECT_CALL(delegate, ControllerDestroyed()); 295 EXPECT_CALL(delegate, ControllerDestroyed());
296 delete test_controller; 296 delete test_controller;
297 } 297 }
298 298
299 #if !defined(OS_ANDROID) 299 #if !defined(OS_ANDROID)
300 TEST_F(AutofillPopupControllerUnitTest, ElideText) { 300 TEST_F(AutofillPopupControllerUnitTest, ElideText) {
301 std::vector<string16> names; 301 std::vector<string16> names;
302 names.push_back(ASCIIToUTF16("Text that will need to be trimmed")); 302 names.push_back(ASCIIToUTF16("Text that will need to be trimmed"));
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 TestAutofillPopupController autofill_popup_controller(&external_delegate_, 385 TestAutofillPopupController autofill_popup_controller(&external_delegate_,
386 element_bounds[i]); 386 element_bounds[i]);
387 autofill_popup_controller.set_display(display); 387 autofill_popup_controller.set_display(display);
388 autofill_popup_controller.Show(names, names, names, autofill_ids); 388 autofill_popup_controller.Show(names, names, names, autofill_ids);
389 389
390 EXPECT_EQ(expected_popup_bounds[i].ToString(), 390 EXPECT_EQ(expected_popup_bounds[i].ToString(),
391 autofill_popup_controller.popup_bounds().ToString()) << 391 autofill_popup_controller.popup_bounds().ToString()) <<
392 "Popup bounds failed to match for test " << i; 392 "Popup bounds failed to match for test " << i;
393 } 393 }
394 } 394 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698