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 "components/suggestions/suggestions_service.h" | 5 #include "components/suggestions/suggestions_service.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 net::URLRequestStatus::Status status) { | 64 net::URLRequestStatus::Status status) { |
65 scoped_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher( | 65 scoped_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher( |
66 url, delegate, response_data, response_code, status)); | 66 url, delegate, response_data, response_code, status)); |
67 | 67 |
68 if (response_code == net::HTTP_OK) { | 68 if (response_code == net::HTTP_OK) { |
69 scoped_refptr<net::HttpResponseHeaders> download_headers( | 69 scoped_refptr<net::HttpResponseHeaders> download_headers( |
70 new net::HttpResponseHeaders("")); | 70 new net::HttpResponseHeaders("")); |
71 download_headers->AddHeader("Content-Type: text/html"); | 71 download_headers->AddHeader("Content-Type: text/html"); |
72 fetcher->set_response_headers(download_headers); | 72 fetcher->set_response_headers(download_headers); |
73 } | 73 } |
74 return fetcher.Pass(); | 74 return fetcher; |
75 } | 75 } |
76 | 76 |
77 // GMock matcher for protobuf equality. | 77 // GMock matcher for protobuf equality. |
78 MATCHER_P(EqualsProto, message, "") { | 78 MATCHER_P(EqualsProto, message, "") { |
79 // This implementation assumes protobuf serialization is deterministic, which | 79 // This implementation assumes protobuf serialization is deterministic, which |
80 // is true in practice but technically not something that code is supposed | 80 // is true in practice but technically not something that code is supposed |
81 // to rely on. However, it vastly simplifies the implementation. | 81 // to rely on. However, it vastly simplifies the implementation. |
82 std::string expected_serialized, actual_serialized; | 82 std::string expected_serialized, actual_serialized; |
83 message.SerializeToString(&expected_serialized); | 83 message.SerializeToString(&expected_serialized); |
84 arg.SerializeToString(&actual_serialized); | 84 arg.SerializeToString(&actual_serialized); |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 suggestions_service->GetPageThumbnail(test_url, dummy_callback); | 716 suggestions_service->GetPageThumbnail(test_url, dummy_callback); |
717 | 717 |
718 EXPECT_CALL(*mock_thumbnail_manager_, AddImageURL(test_url, thumbnail_url)); | 718 EXPECT_CALL(*mock_thumbnail_manager_, AddImageURL(test_url, thumbnail_url)); |
719 EXPECT_CALL(*mock_thumbnail_manager_, GetImageForURL(test_url, _)); | 719 EXPECT_CALL(*mock_thumbnail_manager_, GetImageForURL(test_url, _)); |
720 suggestions_service->GetPageThumbnailWithURL(test_url, thumbnail_url, | 720 suggestions_service->GetPageThumbnailWithURL(test_url, thumbnail_url, |
721 dummy_callback); | 721 dummy_callback); |
722 | 722 |
723 } | 723 } |
724 | 724 |
725 } // namespace suggestions | 725 } // namespace suggestions |
OLD | NEW |