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/policy/url_blacklist_manager.h" | 5 #include "chrome/browser/policy/url_blacklist_manager.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 net::TestURLRequestContext context; | 456 net::TestURLRequestContext context; |
457 net::URLRequest request(GURL("http://google.com"), NULL, &context); | 457 net::URLRequest request(GURL("http://google.com"), NULL, &context); |
458 | 458 |
459 // Background requests aren't filtered. | 459 // Background requests aren't filtered. |
460 EXPECT_FALSE(blacklist_manager_->IsRequestBlocked(request)); | 460 EXPECT_FALSE(blacklist_manager_->IsRequestBlocked(request)); |
461 | 461 |
462 // Main frames are filtered. | 462 // Main frames are filtered. |
463 request.set_load_flags(net::LOAD_MAIN_FRAME); | 463 request.set_load_flags(net::LOAD_MAIN_FRAME); |
464 EXPECT_TRUE(blacklist_manager_->IsRequestBlocked(request)); | 464 EXPECT_TRUE(blacklist_manager_->IsRequestBlocked(request)); |
465 | 465 |
466 // Sync gets a free pass. | 466 // On most platforms, sync gets a free pass due to signin flows. |
| 467 bool block_signin_urls = false; |
| 468 #if defined(OS_CHROMEOS) |
| 469 // There are no sync specific signin flows on Chrome OS, so no special |
| 470 // treatment. |
| 471 block_signin_urls = true; |
| 472 #endif |
| 473 |
467 GURL sync_url( | 474 GURL sync_url( |
468 GaiaUrls::GetInstance()->service_login_url() + "?service=chromiumsync"); | 475 GaiaUrls::GetInstance()->service_login_url() + "?service=chromiumsync"); |
469 net::URLRequest sync_request(sync_url, NULL, &context); | 476 net::URLRequest sync_request(sync_url, NULL, &context); |
470 sync_request.set_load_flags(net::LOAD_MAIN_FRAME); | 477 sync_request.set_load_flags(net::LOAD_MAIN_FRAME); |
471 EXPECT_FALSE(blacklist_manager_->IsRequestBlocked(sync_request)); | 478 EXPECT_EQ(block_signin_urls, |
| 479 blacklist_manager_->IsRequestBlocked(sync_request)); |
472 } | 480 } |
473 | 481 |
474 } // namespace policy | 482 } // namespace policy |
OLD | NEW |