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" |
11 #include "chrome/browser/content_settings/host_content_settings_map.h" | 11 #include "chrome/browser/content_settings/host_content_settings_map.h" |
12 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 12 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 13 #include "chrome/browser/infobars/infobar_delegate.h" |
13 #include "chrome/browser/infobars/infobar_tab_helper.h" | 14 #include "chrome/browser/infobars/infobar_tab_helper.h" |
14 #include "chrome/browser/ui/website_settings/website_settings_ui.h" | 15 #include "chrome/browser/ui/website_settings/website_settings_ui.h" |
15 #include "chrome/common/content_settings.h" | 16 #include "chrome/common/content_settings.h" |
16 #include "chrome/common/content_settings_types.h" | 17 #include "chrome/common/content_settings_types.h" |
17 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 18 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
18 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
19 #include "content/public/browser/cert_store.h" | 20 #include "content/public/browser/cert_store.h" |
20 #include "content/public/common/ssl_status.h" | 21 #include "content/public/common/ssl_status.h" |
21 #include "content/public/test/test_browser_thread.h" | 22 #include "content/public/test/test_browser_thread.h" |
22 #include "net/base/cert_status_flags.h" | 23 #include "net/base/cert_status_flags.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } | 335 } |
335 | 336 |
336 TEST_F(WebsiteSettingsTest, ShowInfoBar) { | 337 TEST_F(WebsiteSettingsTest, ShowInfoBar) { |
337 SetDefaultUIExpectations(mock_ui()); | 338 SetDefaultUIExpectations(mock_ui()); |
338 EXPECT_EQ(0u, infobar_tab_helper()->infobar_count()); | 339 EXPECT_EQ(0u, infobar_tab_helper()->infobar_count()); |
339 website_settings()->OnSitePermissionChanged( | 340 website_settings()->OnSitePermissionChanged( |
340 CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_ALLOW); | 341 CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_ALLOW); |
341 website_settings()->OnUIClosing(); | 342 website_settings()->OnUIClosing(); |
342 EXPECT_EQ(1u, infobar_tab_helper()->infobar_count()); | 343 EXPECT_EQ(1u, infobar_tab_helper()->infobar_count()); |
343 | 344 |
344 infobar_tab_helper()->RemoveInfoBar( | 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 |
| 347 // |infobar_tab_helper|. |
| 348 scoped_ptr<InfoBarDelegate> delegate( |
345 infobar_tab_helper()->GetInfoBarDelegateAt(0)); | 349 infobar_tab_helper()->GetInfoBarDelegateAt(0)); |
| 350 infobar_tab_helper()->RemoveInfoBar(delegate.get()); |
| 351 // Right now InfoBarDelegates delete themselves via |
| 352 // InfoBarClosed(); once InfoBars own their delegates, this can become a |
| 353 // simple reset() call |
| 354 delegate.release()->InfoBarClosed(); |
346 } | 355 } |
OLD | NEW |