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

Side by Side Diff: chrome/browser/managed_mode/managed_mode_url_filter_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 months 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 | Annotate | Revision Log
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" 9 #include "chrome/browser/managed_mode/managed_mode_url_filter.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 15 matching lines...) Expand all
26 virtual void OnSiteListUpdated() OVERRIDE { 26 virtual void OnSiteListUpdated() OVERRIDE {
27 run_loop_.Quit(); 27 run_loop_.Quit();
28 } 28 }
29 29
30 protected: 30 protected:
31 bool IsURLWhitelisted(const std::string& url) { 31 bool IsURLWhitelisted(const std::string& url) {
32 return filter_->GetFilteringBehaviorForURL(GURL(url)) == 32 return filter_->GetFilteringBehaviorForURL(GURL(url)) ==
33 ManagedModeURLFilter::ALLOW; 33 ManagedModeURLFilter::ALLOW;
34 } 34 }
35 35
36 MessageLoop message_loop_; 36 base::MessageLoop message_loop_;
37 base::RunLoop run_loop_; 37 base::RunLoop run_loop_;
38 scoped_refptr<ManagedModeURLFilter> filter_; 38 scoped_refptr<ManagedModeURLFilter> filter_;
39 }; 39 };
40 40
41 // Disable all tests if ENABLE_CONFIGURATION_POLICY is not defined 41 // Disable all tests if ENABLE_CONFIGURATION_POLICY is not defined
42 // Since IsURLWhitelisted() doesn't work. 42 // Since IsURLWhitelisted() doesn't work.
43 #if defined(ENABLE_CONFIGURATION_POLICY) 43 #if defined(ENABLE_CONFIGURATION_POLICY)
44 44
45 TEST_F(ManagedModeURLFilterTest, Basic) { 45 TEST_F(ManagedModeURLFilterTest, Basic) {
46 std::vector<std::string> list; 46 std::vector<std::string> list;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 EXPECT_TRUE(IsURLWhitelisted("HttP://WwW.mOOsE.orG/blurp/")); 181 EXPECT_TRUE(IsURLWhitelisted("HttP://WwW.mOOsE.orG/blurp/"));
182 182
183 // Verify that UTF-8 in hostnames are converted to punycode. 183 // Verify that UTF-8 in hostnames are converted to punycode.
184 EXPECT_TRUE(IsURLWhitelisted("http://www.\xe2\x98\x83\x0a.net/bla/")); 184 EXPECT_TRUE(IsURLWhitelisted("http://www.\xe2\x98\x83\x0a.net/bla/"));
185 185
186 // Verify that query and ref are stripped. 186 // Verify that query and ref are stripped.
187 EXPECT_TRUE(IsURLWhitelisted("http://www.example.com/foo/?bar=baz#ref")); 187 EXPECT_TRUE(IsURLWhitelisted("http://www.example.com/foo/?bar=baz#ref"));
188 } 188 }
189 189
190 #endif // ENABLE_CONFIGURATION_POLICY 190 #endif // ENABLE_CONFIGURATION_POLICY
OLDNEW
« no previous file with comments | « chrome/browser/managed_mode/managed_mode_unittest.cc ('k') | chrome/browser/managed_mode/managed_user_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698