| 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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 blacklist_manager_->SetBlacklist(blacklist.Pass()); | 495 blacklist_manager_->SetBlacklist(blacklist.Pass()); |
| 496 EXPECT_TRUE(blacklist_manager_->IsURLBlocked(GURL("http://google.com"))); | 496 EXPECT_TRUE(blacklist_manager_->IsURLBlocked(GURL("http://google.com"))); |
| 497 | 497 |
| 498 net::TestURLRequestContext context; | 498 net::TestURLRequestContext context; |
| 499 net::URLRequest request(GURL("http://google.com"), NULL, &context); | 499 net::URLRequest request(GURL("http://google.com"), NULL, &context); |
| 500 | 500 |
| 501 // Background requests aren't filtered. | 501 // Background requests aren't filtered. |
| 502 EXPECT_FALSE(blacklist_manager_->IsRequestBlocked(request)); | 502 EXPECT_FALSE(blacklist_manager_->IsRequestBlocked(request)); |
| 503 | 503 |
| 504 // Main frames are filtered. | 504 // Main frames are filtered. |
| 505 request.set_load_flags(net::LOAD_MAIN_FRAME); | 505 request.SetLoadFlags(net::LOAD_MAIN_FRAME); |
| 506 EXPECT_TRUE(blacklist_manager_->IsRequestBlocked(request)); | 506 EXPECT_TRUE(blacklist_manager_->IsRequestBlocked(request)); |
| 507 | 507 |
| 508 // On most platforms, sync gets a free pass due to signin flows. | 508 // On most platforms, sync gets a free pass due to signin flows. |
| 509 bool block_signin_urls = false; | 509 bool block_signin_urls = false; |
| 510 #if defined(OS_CHROMEOS) | 510 #if defined(OS_CHROMEOS) |
| 511 // There are no sync specific signin flows on Chrome OS, so no special | 511 // There are no sync specific signin flows on Chrome OS, so no special |
| 512 // treatment. | 512 // treatment. |
| 513 block_signin_urls = true; | 513 block_signin_urls = true; |
| 514 #endif | 514 #endif |
| 515 | 515 |
| 516 GURL sync_url(GaiaUrls::GetInstance()->service_login_url().Resolve( | 516 GURL sync_url(GaiaUrls::GetInstance()->service_login_url().Resolve( |
| 517 "?service=chromiumsync")); | 517 "?service=chromiumsync")); |
| 518 net::URLRequest sync_request(sync_url, NULL, &context); | 518 net::URLRequest sync_request(sync_url, NULL, &context); |
| 519 sync_request.set_load_flags(net::LOAD_MAIN_FRAME); | 519 sync_request.SetLoadFlags(net::LOAD_MAIN_FRAME); |
| 520 EXPECT_EQ(block_signin_urls, | 520 EXPECT_EQ(block_signin_urls, |
| 521 blacklist_manager_->IsRequestBlocked(sync_request)); | 521 blacklist_manager_->IsRequestBlocked(sync_request)); |
| 522 } | 522 } |
| 523 | 523 |
| 524 } // namespace policy | 524 } // namespace policy |
| OLD | NEW |