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> |
| 8 |
7 #include <map> | 9 #include <map> |
8 #include <sstream> | 10 #include <sstream> |
9 #include <utility> | 11 #include <utility> |
10 | 12 |
11 #include "base/bind.h" | 13 #include "base/bind.h" |
12 #include "base/feature_list.h" | 14 #include "base/feature_list.h" |
| 15 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
14 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" | 17 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" |
15 #include "components/suggestions/blacklist_store.h" | 18 #include "components/suggestions/blacklist_store.h" |
16 #include "components/suggestions/image_manager.h" | 19 #include "components/suggestions/image_manager.h" |
17 #include "components/suggestions/proto/suggestions.pb.h" | 20 #include "components/suggestions/proto/suggestions.pb.h" |
18 #include "components/suggestions/suggestions_store.h" | 21 #include "components/suggestions/suggestions_store.h" |
19 #include "components/suggestions/suggestions_utils.h" | 22 #include "components/suggestions/suggestions_utils.h" |
20 #include "net/base/escape.h" | 23 #include "net/base/escape.h" |
21 #include "net/http/http_response_headers.h" | 24 #include "net/http/http_response_headers.h" |
22 #include "net/http/http_status_code.h" | 25 #include "net/http/http_status_code.h" |
(...skipping 22 matching lines...) Expand all Loading... |
45 const char kTestUrl[] = "http://go.com"; | 48 const char kTestUrl[] = "http://go.com"; |
46 const char kTestFaviconUrl[] = | 49 const char kTestFaviconUrl[] = |
47 "https://s2.googleusercontent.com/s2/favicons?domain_url=" | 50 "https://s2.googleusercontent.com/s2/favicons?domain_url=" |
48 "http://go.com&alt=s&sz=32"; | 51 "http://go.com&alt=s&sz=32"; |
49 const char kTestImpressionUrl[] = | 52 const char kTestImpressionUrl[] = |
50 "https://www.google.com/chromesuggestions/click?q=123&cd=-1"; | 53 "https://www.google.com/chromesuggestions/click?q=123&cd=-1"; |
51 const char kTestClickUrl[] = | 54 const char kTestClickUrl[] = |
52 "https://www.google.com/chromesuggestions/click?q=123&cd=0"; | 55 "https://www.google.com/chromesuggestions/click?q=123&cd=0"; |
53 const char kBlacklistedUrl[] = "http://blacklist.com"; | 56 const char kBlacklistedUrl[] = "http://blacklist.com"; |
54 const char kBlacklistedUrlAlt[] = "http://blacklist-atl.com"; | 57 const char kBlacklistedUrlAlt[] = "http://blacklist-atl.com"; |
55 const int64 kTestDefaultExpiry = 1402200000000000; | 58 const int64_t kTestDefaultExpiry = 1402200000000000; |
56 const int64 kTestSetExpiry = 1404792000000000; | 59 const int64_t kTestSetExpiry = 1404792000000000; |
57 | 60 |
58 scoped_ptr<net::FakeURLFetcher> CreateURLFetcher( | 61 scoped_ptr<net::FakeURLFetcher> CreateURLFetcher( |
59 const GURL& url, net::URLFetcherDelegate* delegate, | 62 const GURL& url, net::URLFetcherDelegate* delegate, |
60 const std::string& response_data, net::HttpStatusCode response_code, | 63 const std::string& response_data, net::HttpStatusCode response_code, |
61 net::URLRequestStatus::Status status) { | 64 net::URLRequestStatus::Status status) { |
62 scoped_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher( | 65 scoped_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher( |
63 url, delegate, response_data, response_code, status)); | 66 url, delegate, response_data, response_code, status)); |
64 | 67 |
65 if (response_code == net::HTTP_OK) { | 68 if (response_code == net::HTTP_OK) { |
66 scoped_refptr<net::HttpResponseHeaders> download_headers( | 69 scoped_refptr<net::HttpResponseHeaders> download_headers( |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 suggestions_service->GetPageThumbnail(test_url, dummy_callback); | 716 suggestions_service->GetPageThumbnail(test_url, dummy_callback); |
714 | 717 |
715 EXPECT_CALL(*mock_thumbnail_manager_, AddImageURL(test_url, thumbnail_url)); | 718 EXPECT_CALL(*mock_thumbnail_manager_, AddImageURL(test_url, thumbnail_url)); |
716 EXPECT_CALL(*mock_thumbnail_manager_, GetImageForURL(test_url, _)); | 719 EXPECT_CALL(*mock_thumbnail_manager_, GetImageForURL(test_url, _)); |
717 suggestions_service->GetPageThumbnailWithURL(test_url, thumbnail_url, | 720 suggestions_service->GetPageThumbnailWithURL(test_url, thumbnail_url, |
718 dummy_callback); | 721 dummy_callback); |
719 | 722 |
720 } | 723 } |
721 | 724 |
722 } // namespace suggestions | 725 } // namespace suggestions |
OLD | NEW |