OLD | NEW |
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/net/safe_search_util.h" | 5 #include "chrome/browser/net/safe_search_util.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
9 #include "net/http/http_request_headers.h" | 9 #include "net/http/http_request_headers.h" |
10 #include "net/url_request/url_request_test_util.h" | 10 #include "net/url_request/url_request_test_util.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 class SafeSearchUtilTest : public ::testing::Test { | 14 class SafeSearchUtilTest : public ::testing::Test { |
15 protected: | 15 protected: |
16 SafeSearchUtilTest() {} | 16 SafeSearchUtilTest() {} |
17 virtual ~SafeSearchUtilTest() {} | 17 ~SafeSearchUtilTest() override {} |
18 | 18 |
19 scoped_ptr<net::URLRequest> CreateYoutubeRequest() { | 19 scoped_ptr<net::URLRequest> CreateYoutubeRequest() { |
20 return context_.CreateRequest(GURL("http://www.youtube.com"), | 20 return context_.CreateRequest(GURL("http://www.youtube.com"), |
21 net::DEFAULT_PRIORITY, | 21 net::DEFAULT_PRIORITY, |
22 NULL, | 22 NULL, |
23 NULL); | 23 NULL); |
24 } | 24 } |
25 | 25 |
26 scoped_ptr<net::URLRequest> CreateNonYoutubeRequest() { | 26 scoped_ptr<net::URLRequest> CreateNonYoutubeRequest() { |
27 return context_.CreateRequest(GURL("http://www.notyoutube.com"), | 27 return context_.CreateRequest(GURL("http://www.notyoutube.com"), |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 "PREF=\"f1=1&f2=4321\"; OtherCookie=value", | 81 "PREF=\"f1=1&f2=4321\"; OtherCookie=value", |
82 "PREF=\"f1=1&f2=8004321\"; OtherCookie=value"); | 82 "PREF=\"f1=1&f2=8004321\"; OtherCookie=value"); |
83 } | 83 } |
84 | 84 |
85 TEST_F(SafeSearchUtilTest, DoesntTouchNonYoutubeURL) { | 85 TEST_F(SafeSearchUtilTest, DoesntTouchNonYoutubeURL) { |
86 scoped_ptr<net::URLRequest> request = CreateNonYoutubeRequest(); | 86 scoped_ptr<net::URLRequest> request = CreateNonYoutubeRequest(); |
87 CheckHeaders(request.get(), | 87 CheckHeaders(request.get(), |
88 "PREF=f2=0", | 88 "PREF=f2=0", |
89 "PREF=f2=0"); | 89 "PREF=f2=0"); |
90 } | 90 } |
OLD | NEW |