Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: chrome/browser/supervised_user/supervised_user_url_filter_unittest.cc

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/supervised_user/supervised_user_url_filter.h" 5 #include "chrome/browser/supervised_user/supervised_user_url_filter.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "chrome/browser/supervised_user/supervised_user_site_list.h" 15 #include "chrome/browser/supervised_user/supervised_user_site_list.h"
16 #include "extensions/features/features.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 #include "url/gurl.h" 18 #include "url/gurl.h"
18 19
19 class SupervisedUserURLFilterTest : public ::testing::Test, 20 class SupervisedUserURLFilterTest : public ::testing::Test,
20 public SupervisedUserURLFilter::Observer { 21 public SupervisedUserURLFilter::Observer {
21 public: 22 public:
22 SupervisedUserURLFilterTest() : filter_(new SupervisedUserURLFilter) { 23 SupervisedUserURLFilterTest() : filter_(new SupervisedUserURLFilter) {
23 filter_->SetDefaultFilteringBehavior(SupervisedUserURLFilter::BLOCK); 24 filter_->SetDefaultFilteringBehavior(SupervisedUserURLFilter::BLOCK);
24 filter_->AddObserver(this); 25 filter_->AddObserver(this);
25 } 26 }
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 filter_->GetMatchingWhitelistTitles(GURL("http://example.com")); 513 filter_->GetMatchingWhitelistTitles(GURL("http://example.com"));
513 ASSERT_EQ(expected_whitelists, actual_whitelists); 514 ASSERT_EQ(expected_whitelists, actual_whitelists);
514 515
515 expected_whitelists.erase(id1); 516 expected_whitelists.erase(id1);
516 517
517 actual_whitelists = 518 actual_whitelists =
518 filter_->GetMatchingWhitelistTitles(GURL("https://secure.com")); 519 filter_->GetMatchingWhitelistTitles(GURL("https://secure.com"));
519 ASSERT_EQ(expected_whitelists, actual_whitelists); 520 ASSERT_EQ(expected_whitelists, actual_whitelists);
520 } 521 }
521 522
522 #if defined(ENABLE_EXTENSIONS) 523 #if BUILDFLAG(ENABLE_EXTENSIONS)
523 TEST_F(SupervisedUserURLFilterTest, ChromeWebstoreDownloadsAreAlwaysAllowed) { 524 TEST_F(SupervisedUserURLFilterTest, ChromeWebstoreDownloadsAreAlwaysAllowed) {
524 // When installing an extension from Chrome Webstore, it tries to download the 525 // When installing an extension from Chrome Webstore, it tries to download the
525 // crx file from "https://clients2.google.com/service/update2/", which 526 // crx file from "https://clients2.google.com/service/update2/", which
526 // redirects to "https://clients2.googleusercontent.com/crx/blobs/" 527 // redirects to "https://clients2.googleusercontent.com/crx/blobs/"
527 // or "https://chrome.google.com/webstore/download/". 528 // or "https://chrome.google.com/webstore/download/".
528 // All URLs should be whitelisted regardless from the default filtering 529 // All URLs should be whitelisted regardless from the default filtering
529 // behavior. 530 // behavior.
530 GURL crx_download_url1( 531 GURL crx_download_url1(
531 "https://clients2.google.com/service/update2/" 532 "https://clients2.google.com/service/update2/"
532 "crx?response=redirect&os=linux&arch=x64&nacl_arch=x86-64&prod=" 533 "crx?response=redirect&os=linux&arch=x64&nacl_arch=x86-64&prod="
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 // Wrong fingerprint. 678 // Wrong fingerprint.
678 EXPECT_EQ(GURL(), GetEmbeddedURL("https://webcache.googleusercontent.com/" 679 EXPECT_EQ(GURL(), GetEmbeddedURL("https://webcache.googleusercontent.com/"
679 "search?q=cache:123:example.com/")); 680 "search?q=cache:123:example.com/"));
680 // Wrong query param. 681 // Wrong query param.
681 EXPECT_EQ(GURL(), GetEmbeddedURL("https://webcache.googleusercontent.com/" 682 EXPECT_EQ(GURL(), GetEmbeddedURL("https://webcache.googleusercontent.com/"
682 "search?a=cache:example.com/")); 683 "search?a=cache:example.com/"));
683 // Invalid scheme. 684 // Invalid scheme.
684 EXPECT_EQ(GURL(), GetEmbeddedURL("https://webcache.googleusercontent.com/" 685 EXPECT_EQ(GURL(), GetEmbeddedURL("https://webcache.googleusercontent.com/"
685 "search?q=cache:abc://example.com/")); 686 "search?q=cache:abc://example.com/"));
686 } 687 }
OLDNEW
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_url_filter.cc ('k') | chrome/browser/sync/chrome_sync_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698