| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/memory/weak_ptr.h" | 6 #include "base/memory/weak_ptr.h" |
| 7 #include "base/prefs/testing_pref_service.h" | 7 #include "base/prefs/testing_pref_service.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/autofill/autofill_external_delegate.h" | 9 #include "chrome/browser/autofill/autofill_external_delegate.h" |
| 10 #include "chrome/browser/autofill/autofill_manager.h" | 10 #include "chrome/browser/autofill/autofill_manager.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 AutofillPopupControllerImpl::GetOrCreate( | 325 AutofillPopupControllerImpl::GetOrCreate( |
| 326 test_controller->GetWeakPtr(), | 326 test_controller->GetWeakPtr(), |
| 327 &delegate, | 327 &delegate, |
| 328 NULL, | 328 NULL, |
| 329 bounds); | 329 bounds); |
| 330 EXPECT_EQ( | 330 EXPECT_EQ( |
| 331 bounds, | 331 bounds, |
| 332 static_cast<AutofillPopupController*>(controller3)->element_bounds()); | 332 static_cast<AutofillPopupController*>(controller3)->element_bounds()); |
| 333 controller3->Hide(); | 333 controller3->Hide(); |
| 334 | 334 |
| 335 delete test_controller; | 335 // Hide the test_controller to delete it. |
| 336 test_controller->DoHide(); |
| 336 } | 337 } |
| 337 | 338 |
| 338 #if !defined(OS_ANDROID) | 339 #if !defined(OS_ANDROID) |
| 339 TEST_F(AutofillPopupControllerUnitTest, ElideText) { | 340 TEST_F(AutofillPopupControllerUnitTest, ElideText) { |
| 340 std::vector<string16> names; | 341 std::vector<string16> names; |
| 341 names.push_back(ASCIIToUTF16("Text that will need to be trimmed")); | 342 names.push_back(ASCIIToUTF16("Text that will need to be trimmed")); |
| 342 names.push_back(ASCIIToUTF16("Untrimmed")); | 343 names.push_back(ASCIIToUTF16("Untrimmed")); |
| 343 | 344 |
| 344 std::vector<string16> subtexts; | 345 std::vector<string16> subtexts; |
| 345 subtexts.push_back(ASCIIToUTF16("Label that will be trimmed")); | 346 subtexts.push_back(ASCIIToUTF16("Label that will be trimmed")); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 autofill_popup_controller->Show(names, names, names, autofill_ids); | 435 autofill_popup_controller->Show(names, names, names, autofill_ids); |
| 435 | 436 |
| 436 EXPECT_EQ(expected_popup_bounds[i].ToString(), | 437 EXPECT_EQ(expected_popup_bounds[i].ToString(), |
| 437 autofill_popup_controller->popup_bounds().ToString()) << | 438 autofill_popup_controller->popup_bounds().ToString()) << |
| 438 "Popup bounds failed to match for test " << i; | 439 "Popup bounds failed to match for test " << i; |
| 439 | 440 |
| 440 // Hide the controller to delete it. | 441 // Hide the controller to delete it. |
| 441 autofill_popup_controller->DoHide(); | 442 autofill_popup_controller->DoHide(); |
| 442 } | 443 } |
| 443 } | 444 } |
| OLD | NEW |