| 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 "chrome/browser/ui/website_settings/website_settings.h" | 5 #include "chrome/browser/ui/website_settings/website_settings.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 322 |
| 323 EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED_ERROR, | 323 EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED_ERROR, |
| 324 website_settings()->site_connection_status()); | 324 website_settings()->site_connection_status()); |
| 325 EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_CERT, | 325 EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_CERT, |
| 326 website_settings()->site_identity_status()); | 326 website_settings()->site_identity_status()); |
| 327 EXPECT_EQ(string16(), website_settings()->organization_name()); | 327 EXPECT_EQ(string16(), website_settings()->organization_name()); |
| 328 } | 328 } |
| 329 | 329 |
| 330 TEST_F(WebsiteSettingsTest, NoInfoBar) { | 330 TEST_F(WebsiteSettingsTest, NoInfoBar) { |
| 331 SetDefaultUIExpectations(mock_ui()); | 331 SetDefaultUIExpectations(mock_ui()); |
| 332 EXPECT_EQ(0u, infobar_tab_helper()->infobar_count()); | 332 EXPECT_EQ(0u, infobar_tab_helper()->GetInfoBarCount()); |
| 333 website_settings()->OnUIClosing(); | 333 website_settings()->OnUIClosing(); |
| 334 EXPECT_EQ(0u, infobar_tab_helper()->infobar_count()); | 334 EXPECT_EQ(0u, infobar_tab_helper()->GetInfoBarCount()); |
| 335 } | 335 } |
| 336 | 336 |
| 337 TEST_F(WebsiteSettingsTest, ShowInfoBar) { | 337 TEST_F(WebsiteSettingsTest, ShowInfoBar) { |
| 338 SetDefaultUIExpectations(mock_ui()); | 338 SetDefaultUIExpectations(mock_ui()); |
| 339 EXPECT_EQ(0u, infobar_tab_helper()->infobar_count()); | 339 EXPECT_EQ(0u, infobar_tab_helper()->GetInfoBarCount()); |
| 340 website_settings()->OnSitePermissionChanged( | 340 website_settings()->OnSitePermissionChanged( |
| 341 CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_ALLOW); | 341 CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_ALLOW); |
| 342 website_settings()->OnUIClosing(); | 342 website_settings()->OnUIClosing(); |
| 343 EXPECT_EQ(1u, infobar_tab_helper()->infobar_count()); | 343 EXPECT_EQ(1u, infobar_tab_helper()->GetInfoBarCount()); |
| 344 | 344 |
| 345 // Removing an |InfoBarDelegate| from the |InfoBarTabHelper| does not delete | 345 // Removing an |InfoBarDelegate| from the |InfoBarTabHelper| does not delete |
| 346 // it. Hence the |delegate| must be cleaned up after it was removed from the | 346 // it. Hence the |delegate| must be cleaned up after it was removed from the |
| 347 // |infobar_tab_helper|. | 347 // |infobar_tab_helper|. |
| 348 scoped_ptr<InfoBarDelegate> delegate( | 348 scoped_ptr<InfoBarDelegate> delegate( |
| 349 infobar_tab_helper()->GetInfoBarDelegateAt(0)); | 349 infobar_tab_helper()->GetInfoBarDelegateAt(0)); |
| 350 infobar_tab_helper()->RemoveInfoBar(delegate.get()); | 350 infobar_tab_helper()->RemoveInfoBar(delegate.get()); |
| 351 // Right now InfoBarDelegates delete themselves via | 351 // Right now InfoBarDelegates delete themselves via |
| 352 // InfoBarClosed(); once InfoBars own their delegates, this can become a | 352 // InfoBarClosed(); once InfoBars own their delegates, this can become a |
| 353 // simple reset() call | 353 // simple reset() call |
| 354 delegate.release()->InfoBarClosed(); | 354 delegate.release()->InfoBarClosed(); |
| 355 } | 355 } |
| OLD | NEW |