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/ui/autofill/autofill_popup_controller_impl.h" | 9 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
10 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 10 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 } | 358 } |
359 | 359 |
360 TEST_F(AutofillPopupControllerUnitTest, GetOrCreate) { | 360 TEST_F(AutofillPopupControllerUnitTest, GetOrCreate) { |
361 MockAutofillExternalDelegate delegate( | 361 MockAutofillExternalDelegate delegate( |
362 web_contents(), AutofillManager::FromWebContents(web_contents())); | 362 web_contents(), AutofillManager::FromWebContents(web_contents())); |
363 | 363 |
364 WeakPtr<AutofillPopupControllerImpl> controller = | 364 WeakPtr<AutofillPopupControllerImpl> controller = |
365 AutofillPopupControllerImpl::GetOrCreate( | 365 AutofillPopupControllerImpl::GetOrCreate( |
366 WeakPtr<AutofillPopupControllerImpl>(), delegate.GetWeakPtr(), NULL, | 366 WeakPtr<AutofillPopupControllerImpl>(), delegate.GetWeakPtr(), NULL, |
367 gfx::Rect()); | 367 gfx::Rect()); |
368 EXPECT_TRUE(controller); | 368 EXPECT_TRUE(controller.get()); |
369 | 369 |
370 controller->Hide(); | 370 controller->Hide(); |
371 | 371 |
372 controller = AutofillPopupControllerImpl::GetOrCreate( | 372 controller = AutofillPopupControllerImpl::GetOrCreate( |
373 WeakPtr<AutofillPopupControllerImpl>(), delegate.GetWeakPtr(), NULL, | 373 WeakPtr<AutofillPopupControllerImpl>(), delegate.GetWeakPtr(), NULL, |
374 gfx::Rect()); | 374 gfx::Rect()); |
375 EXPECT_TRUE(controller); | 375 EXPECT_TRUE(controller.get()); |
376 | 376 |
377 WeakPtr<AutofillPopupControllerImpl> controller2 = | 377 WeakPtr<AutofillPopupControllerImpl> controller2 = |
378 AutofillPopupControllerImpl::GetOrCreate(controller, | 378 AutofillPopupControllerImpl::GetOrCreate(controller, |
379 delegate.GetWeakPtr(), | 379 delegate.GetWeakPtr(), |
380 NULL, | 380 NULL, |
381 gfx::Rect()); | 381 gfx::Rect()); |
382 EXPECT_EQ(controller.get(), controller2.get()); | 382 EXPECT_EQ(controller.get(), controller2.get()); |
383 controller->Hide(); | 383 controller->Hide(); |
384 | 384 |
385 testing::NiceMock<TestAutofillPopupController>* test_controller = | 385 testing::NiceMock<TestAutofillPopupController>* test_controller = |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 EXPECT_EQ(expected_popup_bounds[i].ToString(), | 523 EXPECT_EQ(expected_popup_bounds[i].ToString(), |
524 autofill_popup_controller->popup_bounds().ToString()) << | 524 autofill_popup_controller->popup_bounds().ToString()) << |
525 "Popup bounds failed to match for test " << i; | 525 "Popup bounds failed to match for test " << i; |
526 | 526 |
527 // Hide the controller to delete it. | 527 // Hide the controller to delete it. |
528 autofill_popup_controller->DoHide(); | 528 autofill_popup_controller->DoHide(); |
529 } | 529 } |
530 } | 530 } |
531 | 531 |
532 } // namespace autofill | 532 } // namespace autofill |
OLD | NEW |