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

Unified Diff: components/ntp_snippets/ntp_snippets_service_unittest.cc

Issue 1863213004: [NTP Snippets] Cleanup: remove NTPSnippetsService::is_loaded() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove now-pointless tests Created 4 years, 8 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/ntp_snippets/ntp_snippets_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/ntp_snippets_service_unittest.cc
diff --git a/components/ntp_snippets/ntp_snippets_service_unittest.cc b/components/ntp_snippets/ntp_snippets_service_unittest.cc
index 18f4a2ee44f58d5330f7c1dd11d2abe33ecd207f..699a20ff5f506b6ec8a5db9d7bcb0d875aa17c68 100644
--- a/components/ntp_snippets/ntp_snippets_service_unittest.cc
+++ b/components/ntp_snippets/ntp_snippets_service_unittest.cc
@@ -79,27 +79,6 @@ void ParseJson(
}
}
-class SnippetObserver : public NTPSnippetsServiceObserver {
- public:
- SnippetObserver() : loaded_(false), shutdown_(false) {}
- ~SnippetObserver() override {}
-
- void NTPSnippetsServiceLoaded(NTPSnippetsService* service) override {
- loaded_ = true;
- }
-
- void NTPSnippetsServiceShutdown(NTPSnippetsService* service) override {
- shutdown_ = true;
- loaded_ = false;
- }
-
- bool loaded_;
- bool shutdown_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(SnippetObserver);
-};
-
} // namespace
class NTPSnippetsServiceTest : public testing::Test {
@@ -148,21 +127,13 @@ class NTPSnippetsServiceTest : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(NTPSnippetsServiceTest);
};
-TEST_F(NTPSnippetsServiceTest, Create) {
- EXPECT_FALSE(service()->is_loaded());
-}
-
TEST_F(NTPSnippetsServiceTest, Loop) {
- EXPECT_FALSE(service()->is_loaded());
-
std::string json_str(
"{ \"recos\": [ "
"{ \"contentInfo\": { \"url\" : \"http://localhost/foobar\" }}"
"]}");
ASSERT_TRUE(LoadFromJSONString(json_str));
- EXPECT_TRUE(service()->is_loaded());
-
// The same for loop without the '&' should not compile.
for (auto& snippet : *service()) {
// Snippet here is a const.
@@ -200,7 +171,6 @@ TEST_F(NTPSnippetsServiceTest, Discard) {
std::string json_str(
"{ \"recos\": [ { \"contentInfo\": { \"url\" : \"http://site.com\" }}]}");
ASSERT_TRUE(LoadFromJSONString(json_str));
- ASSERT_TRUE(service()->is_loaded());
ASSERT_EQ(1u, service()->size());
@@ -248,34 +218,4 @@ TEST_F(NTPSnippetsServiceTest, RemoveExpiredContent) {
EXPECT_EQ(service()->size(), 0u);
}
-TEST_F(NTPSnippetsServiceTest, ObserverNotLoaded) {
- SnippetObserver observer;
- ScopedObserver<NTPSnippetsService, SnippetObserver> scoped_observer(
- &observer);
- scoped_observer.Add(service());
- EXPECT_FALSE(observer.loaded_);
-
- std::string json_str(
- "{ \"recos\": [ "
- "{ \"contentInfo\": { \"url\" : \"http://localhost/foobar\" }}"
- "]}");
- ASSERT_TRUE(LoadFromJSONString(json_str));
- EXPECT_TRUE(observer.loaded_);
-}
-
-TEST_F(NTPSnippetsServiceTest, ObserverLoaded) {
- std::string json_str(
- "{ \"recos\": [ "
- "{ \"contentInfo\": { \"url\" : \"http://localhost/foobar\" }}"
- "]}");
- ASSERT_TRUE(LoadFromJSONString(json_str));
-
- SnippetObserver observer;
- ScopedObserver<NTPSnippetsService, SnippetObserver> scoped_observer(
- &observer);
- scoped_observer.Add(service());
-
- EXPECT_TRUE(observer.loaded_);
-}
-
} // namespace ntp_snippets
« no previous file with comments | « components/ntp_snippets/ntp_snippets_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698