| 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 EXPECT_EQ(0U, infobar_service()->GetInfoBarCount()); | 663 EXPECT_EQ(0U, infobar_service()->GetInfoBarCount()); |
| 664 // Go back: navigate to a pending entry before requesting geolocation | 664 // Go back: navigate to a pending entry before requesting geolocation |
| 665 // permission. | 665 // permission. |
| 666 web_contents()->GetController().GoBack(); | 666 web_contents()->GetController().GoBack(); |
| 667 // Request permission for the committed frame (not the pending one). | 667 // Request permission for the committed frame (not the pending one). |
| 668 RequestGeolocationPermission(RequestID(0), requesting_frame_1); | 668 RequestGeolocationPermission(RequestID(0), requesting_frame_1); |
| 669 // Ensure the infobar is created. | 669 // Ensure the infobar is created. |
| 670 ASSERT_EQ(1U, infobar_service()->GetInfoBarCount()); | 670 ASSERT_EQ(1U, infobar_service()->GetInfoBarCount()); |
| 671 InfoBarDelegate* infobar_0 = infobar_service()->GetInfoBarDelegateAt(0); | 671 InfoBarDelegate* infobar_0 = infobar_service()->GetInfoBarDelegateAt(0); |
| 672 ASSERT_TRUE(infobar_0); | 672 ASSERT_TRUE(infobar_0); |
| 673 // Ensure the infobar is not yet expired. | 673 // Ensure the infobar wouldn't expire for a navigation to the committed entry. |
| 674 content::LoadCommittedDetails details; | 674 content::LoadCommittedDetails details; |
| 675 details.entry = web_contents()->GetController().GetLastCommittedEntry(); | 675 details.entry = web_contents()->GetController().GetLastCommittedEntry(); |
| 676 ASSERT_FALSE(infobar_0->ShouldExpire(details)); | 676 EXPECT_FALSE(infobar_0->ShouldExpire(details)); |
| 677 // Commit the "GoBack()" above, and ensure the infobar is now expired. | 677 // Ensure the infobar will expire when we commit the pending navigation. |
| 678 content::WebContentsTester::For(web_contents())->CommitPendingNavigation(); | 678 details.entry = web_contents()->GetController().GetActiveEntry(); |
| 679 details.entry = web_contents()->GetController().GetLastCommittedEntry(); | 679 EXPECT_TRUE(infobar_0->ShouldExpire(details)); |
| 680 ASSERT_TRUE(infobar_0->ShouldExpire(details)); | |
| 681 | 680 |
| 682 // Delete the tab contents. | 681 // Delete the tab contents. |
| 683 DeleteContents(); | 682 DeleteContents(); |
| 684 infobar_0->InfoBarClosed(); | 683 infobar_0->InfoBarClosed(); |
| 685 } | 684 } |
| OLD | NEW |