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/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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 gfx::Rect(0, 0, desired_width, desired_height)); | 371 gfx::Rect(0, 0, desired_width, desired_height)); |
372 | 372 |
373 // The popup would be partially off the bottom and the right side of | 373 // The popup would be partially off the bottom and the right side of |
374 // the screen. | 374 // the screen. |
375 element_bounds.push_back( | 375 element_bounds.push_back( |
376 gfx::RectF(desired_width * 1.5, desired_height * 1.5, 0, 0)); | 376 gfx::RectF(desired_width * 1.5, desired_height * 1.5, 0, 0)); |
377 expected_popup_bounds.push_back(gfx::Rect( | 377 expected_popup_bounds.push_back(gfx::Rect( |
378 desired_width / 2, desired_height /2, desired_width, desired_height)); | 378 desired_width / 2, desired_height /2, desired_width, desired_height)); |
379 | 379 |
380 for (size_t i = 0; i < element_bounds.size(); ++i) { | 380 for (size_t i = 0; i < element_bounds.size(); ++i) { |
381 TestAutofillPopupController autofill_popup_controller(&external_delegate_, | 381 TestAutofillPopupController* autofill_popup_controller = |
382 element_bounds[i]); | 382 new TestAutofillPopupController(&external_delegate_, |
383 autofill_popup_controller.set_display(display); | 383 element_bounds[i]); |
384 autofill_popup_controller.Show(names, names, names, autofill_ids); | 384 |
| 385 autofill_popup_controller->set_display(display); |
| 386 autofill_popup_controller->Show(names, names, names, autofill_ids); |
385 | 387 |
386 EXPECT_EQ(expected_popup_bounds[i].ToString(), | 388 EXPECT_EQ(expected_popup_bounds[i].ToString(), |
387 autofill_popup_controller.popup_bounds().ToString()) << | 389 autofill_popup_controller->popup_bounds().ToString()) << |
388 "Popup bounds failed to match for test " << i; | 390 "Popup bounds failed to match for test " << i; |
| 391 |
| 392 // Hide the controller to delete it. |
| 393 autofill_popup_controller->DoHide(); |
389 } | 394 } |
390 } | 395 } |
OLD | NEW |