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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/favicon/core/favicon_service_impl_unittest.cc
diff --git a/components/favicon/core/favicon_service_impl_unittest.cc b/components/favicon/core/favicon_service_impl_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..65b98fbe33d7a273c2d7a49db6072724f9e8c961
--- /dev/null
+++ b/components/favicon/core/favicon_service_impl_unittest.cc
@@ -0,0 +1,46 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/favicon/core/favicon_service_impl.h"
+
+#include <memory>
+
+#include "base/files/scoped_temp_dir.h"
+#include "base/message_loop/message_loop.h"
+#include "components/favicon/core/favicon_client.h"
+#include "components/history/core/browser/history_service.h"
+#include "components/history/core/test/history_service_test_util.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace favicon {
+namespace {
+
+TEST(FaviconServiceImplTest, ShouldCacheUnableToDownloadFavicons) {
+ base::MessageLoop message_loop;
+ base::ScopedTempDir history_dir;
+ CHECK(history_dir.CreateUniqueTempDir());
+ std::unique_ptr<history::HistoryService> history_service =
+ history::CreateHistoryService(history_dir.GetPath(), /*create_db=*/false);
+ FaviconServiceImpl favicon_service(
+ /*favicon_client=*/nullptr, history_service.get());
+
+ const GURL icon1("http://www.google.com/favicon.ico");
+ const GURL icon2("http://www.youtube.com/favicon.ico");
+ EXPECT_FALSE(favicon_service.WasUnableToDownloadFavicon(icon1));
+ EXPECT_FALSE(favicon_service.WasUnableToDownloadFavicon(icon2));
+
+ favicon_service.UnableToDownloadFavicon(icon1);
+ EXPECT_TRUE(favicon_service.WasUnableToDownloadFavicon(icon1));
+ EXPECT_FALSE(favicon_service.WasUnableToDownloadFavicon(icon2));
+
+ favicon_service.UnableToDownloadFavicon(icon2);
+ EXPECT_TRUE(favicon_service.WasUnableToDownloadFavicon(icon2));
+
+ favicon_service.ClearUnableToDownloadFavicons();
+ EXPECT_FALSE(favicon_service.WasUnableToDownloadFavicon(icon1));
+ EXPECT_FALSE(favicon_service.WasUnableToDownloadFavicon(icon2));
+}
+
+} // namespace
+} // namespace favicon
« 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