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