Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: components/favicon/core/favicon_service_impl_unittest.cc

Issue 2698473004: Split FaviconService and FaviconServiceImpl. (Closed)
Patch Set: Revert changes in ios/.../history_collection_view_controller_unittest.mm Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/favicon/core/favicon_service_impl.h"
6
7 #include <memory>
8
9 #include "base/files/scoped_temp_dir.h"
10 #include "base/message_loop/message_loop.h"
11 #include "components/favicon/core/favicon_client.h"
12 #include "components/history/core/browser/history_service.h"
13 #include "components/history/core/test/history_service_test_util.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15
16 namespace favicon {
17 namespace {
18
19 TEST(FaviconServiceImplTest, ShouldCacheUnableToDownloadFavicons) {
20 base::MessageLoop message_loop;
21 base::ScopedTempDir history_dir;
22 CHECK(history_dir.CreateUniqueTempDir());
23 std::unique_ptr<history::HistoryService> history_service =
24 history::CreateHistoryService(history_dir.GetPath(), /*create_db=*/false);
25 FaviconServiceImpl favicon_service(
26 /*favicon_client=*/nullptr, history_service.get());
27
28 const GURL icon1("http://www.google.com/favicon.ico");
29 const GURL icon2("http://www.youtube.com/favicon.ico");
30 EXPECT_FALSE(favicon_service.WasUnableToDownloadFavicon(icon1));
31 EXPECT_FALSE(favicon_service.WasUnableToDownloadFavicon(icon2));
32
33 favicon_service.UnableToDownloadFavicon(icon1);
34 EXPECT_TRUE(favicon_service.WasUnableToDownloadFavicon(icon1));
35 EXPECT_FALSE(favicon_service.WasUnableToDownloadFavicon(icon2));
36
37 favicon_service.UnableToDownloadFavicon(icon2);
38 EXPECT_TRUE(favicon_service.WasUnableToDownloadFavicon(icon2));
39
40 favicon_service.ClearUnableToDownloadFavicons();
41 EXPECT_FALSE(favicon_service.WasUnableToDownloadFavicon(icon1));
42 EXPECT_FALSE(favicon_service.WasUnableToDownloadFavicon(icon2));
43 }
44
45 } // namespace
46 } // namespace favicon
OLDNEW
« no previous file with comments | « components/favicon/core/favicon_service_impl.cc ('k') | components/favicon/core/large_icon_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698