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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 net::TestURLRequestContext context; | 508 net::TestURLRequestContext context; |
509 net::URLRequest request(GURL("http://google.com"), NULL, &context); | 509 net::URLRequest request(GURL("http://google.com"), NULL, &context); |
510 | 510 |
511 // Background requests aren't filtered. | 511 // Background requests aren't filtered. |
512 EXPECT_FALSE(blacklist_manager_->IsRequestBlocked(request)); | 512 EXPECT_FALSE(blacklist_manager_->IsRequestBlocked(request)); |
513 | 513 |
514 // Main frames are filtered. | 514 // Main frames are filtered. |
515 request.set_load_flags(net::LOAD_MAIN_FRAME); | 515 request.set_load_flags(net::LOAD_MAIN_FRAME); |
516 EXPECT_TRUE(blacklist_manager_->IsRequestBlocked(request)); | 516 EXPECT_TRUE(blacklist_manager_->IsRequestBlocked(request)); |
517 | 517 |
518 // Sync gets a free pass. | 518 // On most platforms, sync gets a free pass due to signin flows. |
| 519 bool block_signin_urls = false; |
| 520 #if defined(OS_CHROMEOS) |
| 521 // There are no sync specific signin flows on Chrome OS, so no special |
| 522 // treatment. |
| 523 block_signin_urls = true; |
| 524 #endif |
| 525 |
519 GURL sync_url( | 526 GURL sync_url( |
520 GaiaUrls::GetInstance()->service_login_url() + "?service=chromiumsync"); | 527 GaiaUrls::GetInstance()->service_login_url() + "?service=chromiumsync"); |
521 net::URLRequest sync_request(sync_url, NULL, &context); | 528 net::URLRequest sync_request(sync_url, NULL, &context); |
522 sync_request.set_load_flags(net::LOAD_MAIN_FRAME); | 529 sync_request.set_load_flags(net::LOAD_MAIN_FRAME); |
523 EXPECT_FALSE(blacklist_manager_->IsRequestBlocked(sync_request)); | 530 EXPECT_EQ(block_signin_urls, |
| 531 blacklist_manager_->IsRequestBlocked(sync_request)); |
524 } | 532 } |
525 | 533 |
526 } // namespace policy | 534 } // namespace policy |
OLD | NEW |