OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/favicon/content/content_favicon_driver.h" | 5 #include "components/favicon/content/content_favicon_driver.h" |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 #include "base/macros.h" | 9 #include "base/macros.h" |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "components/favicon/core/favicon_client.h" | 10 #include "components/favicon/core/favicon_client.h" |
10 #include "components/favicon/core/favicon_handler.h" | 11 #include "components/favicon/core/favicon_handler.h" |
11 #include "components/favicon/core/favicon_service.h" | 12 #include "components/favicon/core/favicon_service.h" |
12 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
13 #include "content/public/common/favicon_url.h" | 14 #include "content/public/common/favicon_url.h" |
14 #include "content/public/test/test_renderer_host.h" | 15 #include "content/public/test/test_renderer_host.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "third_party/skia/include/core/SkBitmap.h" | 17 #include "third_party/skia/include/core/SkBitmap.h" |
17 #include "ui/gfx/favicon_size.h" | 18 #include "ui/gfx/favicon_size.h" |
18 | 19 |
(...skipping 13 matching lines...) Expand all Loading... |
32 favicon_service_.reset(new FaviconService(nullptr, nullptr)); | 33 favicon_service_.reset(new FaviconService(nullptr, nullptr)); |
33 ContentFaviconDriver::CreateForWebContents( | 34 ContentFaviconDriver::CreateForWebContents( |
34 web_contents(), favicon_service(), nullptr, nullptr); | 35 web_contents(), favicon_service(), nullptr, nullptr); |
35 } | 36 } |
36 | 37 |
37 FaviconService* favicon_service() { | 38 FaviconService* favicon_service() { |
38 return favicon_service_.get(); | 39 return favicon_service_.get(); |
39 } | 40 } |
40 | 41 |
41 private: | 42 private: |
42 scoped_ptr<FaviconService> favicon_service_; | 43 std::unique_ptr<FaviconService> favicon_service_; |
43 | 44 |
44 DISALLOW_COPY_AND_ASSIGN(ContentFaviconDriverTest); | 45 DISALLOW_COPY_AND_ASSIGN(ContentFaviconDriverTest); |
45 }; | 46 }; |
46 | 47 |
47 // Test that Favicon is not requested repeatedly during the same session if | 48 // Test that Favicon is not requested repeatedly during the same session if |
48 // server returns HTTP 404 status. | 49 // server returns HTTP 404 status. |
49 TEST_F(ContentFaviconDriverTest, UnableToDownloadFavicon) { | 50 TEST_F(ContentFaviconDriverTest, UnableToDownloadFavicon) { |
50 const GURL missing_icon_url("http://www.google.com/favicon.ico"); | 51 const GURL missing_icon_url("http://www.google.com/favicon.ico"); |
51 const GURL another_icon_url("http://www.youtube.com/favicon.ico"); | 52 const GURL another_icon_url("http://www.youtube.com/favicon.ico"); |
52 | 53 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 favicon::ContentFaviconDriver::FromWebContents(web_contents()); | 123 favicon::ContentFaviconDriver::FromWebContents(web_contents()); |
123 static_cast<content::WebContentsObserver*>(driver) | 124 static_cast<content::WebContentsObserver*>(driver) |
124 ->DidUpdateFaviconURL(favicon_urls); | 125 ->DidUpdateFaviconURL(favicon_urls); |
125 | 126 |
126 // Test that ContentFaviconDriver ignored the favicon url update. | 127 // Test that ContentFaviconDriver ignored the favicon url update. |
127 EXPECT_TRUE(driver->favicon_urls().empty()); | 128 EXPECT_TRUE(driver->favicon_urls().empty()); |
128 } | 129 } |
129 | 130 |
130 } // namespace | 131 } // namespace |
131 } // namespace favicon | 132 } // namespace favicon |
OLD | NEW |