| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 CONTENT_SETTINGS_TYPE_POPUPS, | 361 CONTENT_SETTINGS_TYPE_POPUPS, |
| 362 std::string(), | 362 std::string(), |
| 363 CONTENT_SETTING_ALLOW); | 363 CONTENT_SETTING_ALLOW); |
| 364 | 364 |
| 365 // Popup from the iframe should be allowed since the top-level URL is | 365 // Popup from the iframe should be allowed since the top-level URL is |
| 366 // whitelisted. | 366 // whitelisted. |
| 367 NavigateAndCheckPopupShown(url, ExpectTab); | 367 NavigateAndCheckPopupShown(url, ExpectTab); |
| 368 | 368 |
| 369 // Whitelist iframe URL instead. | 369 // Whitelist iframe URL instead. |
| 370 GURL::Replacements replace_host; | 370 GURL::Replacements replace_host; |
| 371 std::string host_str("www.a.com"); // Must stay in scope with replace_host | 371 replace_host.SetHostStr("www.a.com"); |
| 372 replace_host.SetHostStr(host_str); | |
| 373 GURL frame_url(embedded_test_server() | 372 GURL frame_url(embedded_test_server() |
| 374 ->GetURL("/popup_blocker/popup-frames-iframe.html") | 373 ->GetURL("/popup_blocker/popup-frames-iframe.html") |
| 375 .ReplaceComponents(replace_host)); | 374 .ReplaceComponents(replace_host)); |
| 376 browser()->profile()->GetHostContentSettingsMap()->ClearSettingsForOneType( | 375 browser()->profile()->GetHostContentSettingsMap()->ClearSettingsForOneType( |
| 377 CONTENT_SETTINGS_TYPE_POPUPS); | 376 CONTENT_SETTINGS_TYPE_POPUPS); |
| 378 browser()->profile()->GetHostContentSettingsMap() | 377 browser()->profile()->GetHostContentSettingsMap() |
| 379 ->SetContentSetting(ContentSettingsPattern::FromURL(frame_url), | 378 ->SetContentSetting(ContentSettingsPattern::FromURL(frame_url), |
| 380 ContentSettingsPattern::Wildcard(), | 379 ContentSettingsPattern::Wildcard(), |
| 381 CONTENT_SETTINGS_TYPE_POPUPS, | 380 CONTENT_SETTINGS_TYPE_POPUPS, |
| 382 std::string(), | 381 std::string(), |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 wait_for_new_tab.Wait(); | 669 wait_for_new_tab.Wait(); |
| 671 | 670 |
| 672 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), | 671 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), |
| 673 browser()->host_desktop_type())); | 672 browser()->host_desktop_type())); |
| 674 ASSERT_EQ(2, browser()->tab_strip_model()->count()); | 673 ASSERT_EQ(2, browser()->tab_strip_model()->count()); |
| 675 // Check that we create the background tab. | 674 // Check that we create the background tab. |
| 676 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); | 675 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); |
| 677 } | 676 } |
| 678 | 677 |
| 679 } // namespace | 678 } // namespace |
| OLD | NEW |