| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 result_count); | 46 result_count); |
| 47 dict.SetWithoutPathExpansion("searchInformation", search_info_dict); | 47 dict.SetWithoutPathExpansion("searchInformation", search_info_dict); |
| 48 if (result_count != "0") { | 48 if (result_count != "0") { |
| 49 base::ListValue* results_list = new base::ListValue; | 49 base::ListValue* results_list = new base::ListValue; |
| 50 base::DictionaryValue* result_dict = new base::DictionaryValue; | 50 base::DictionaryValue* result_dict = new base::DictionaryValue; |
| 51 result_dict->SetStringWithoutPathExpansion("link", url.spec()); | 51 result_dict->SetStringWithoutPathExpansion("link", url.spec()); |
| 52 results_list->Append(result_dict); | 52 results_list->Append(result_dict); |
| 53 dict.SetWithoutPathExpansion("items", results_list); | 53 dict.SetWithoutPathExpansion("items", results_list); |
| 54 } | 54 } |
| 55 std::string result; | 55 std::string result; |
| 56 base::JSONWriter::Write(&dict, &result); | 56 base::JSONWriter::Write(dict, &result); |
| 57 return result; | 57 return result; |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace | 60 } // namespace |
| 61 | 61 |
| 62 class SupervisedUserAsyncURLCheckerTest : public testing::Test { | 62 class SupervisedUserAsyncURLCheckerTest : public testing::Test { |
| 63 public: | 63 public: |
| 64 SupervisedUserAsyncURLCheckerTest() | 64 SupervisedUserAsyncURLCheckerTest() |
| 65 : next_url_(0), | 65 : next_url_(0), |
| 66 request_context_(new net::TestURLRequestContextGetter( | 66 request_context_(new net::TestURLRequestContextGetter( |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 TEST_F(SupervisedUserAsyncURLCheckerTest, CoalesceRequestsToSameURL) { | 222 TEST_F(SupervisedUserAsyncURLCheckerTest, CoalesceRequestsToSameURL) { |
| 223 GURL url(GetNewURL()); | 223 GURL url(GetNewURL()); |
| 224 // Start two checks for the same URL. | 224 // Start two checks for the same URL. |
| 225 EXPECT_FALSE(CheckURL(url)); | 225 EXPECT_FALSE(CheckURL(url)); |
| 226 EXPECT_FALSE(CheckURL(url)); | 226 EXPECT_FALSE(CheckURL(url)); |
| 227 // A single response should answer both checks. | 227 // A single response should answer both checks. |
| 228 EXPECT_CALL(*this, OnCheckDone(url, SupervisedUserURLFilter::ALLOW, false)) | 228 EXPECT_CALL(*this, OnCheckDone(url, SupervisedUserURLFilter::ALLOW, false)) |
| 229 .Times(2); | 229 .Times(2); |
| 230 SendValidResponse(true, url); | 230 SendValidResponse(true, url); |
| 231 } | 231 } |
| OLD | NEW |