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

Side by Side Diff: components/ntp_snippets/ntp_snippets_service_unittest.cc

Issue 1910633005: Display status message for "Add snippets" on chrome://snippets-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: The final version ;) Created 4 years, 7 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
« no previous file with comments | « components/ntp_snippets/ntp_snippets_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ntp_snippets/ntp_snippets_service.h" 5 #include "components/ntp_snippets/ntp_snippets_service.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 EXPECT_CALL(*scheduler_, Schedule(_, _, _, _)); 149 EXPECT_CALL(*scheduler_, Schedule(_, _, _, _));
150 else 150 else
151 EXPECT_CALL(*scheduler_, Unschedule()); 151 EXPECT_CALL(*scheduler_, Unschedule());
152 service_->Init(enabled); 152 service_->Init(enabled);
153 } 153 }
154 154
155 protected: 155 protected:
156 NTPSnippetsService* service() { return service_.get(); } 156 NTPSnippetsService* service() { return service_.get(); }
157 157
158 void LoadFromJSONString(const std::string& json) { 158 void LoadFromJSONString(const std::string& json) {
159 service_->OnSnippetsDownloaded(json); 159 service_->OnSnippetsDownloaded(json, std::string());
160 } 160 }
161 161
162 void SetExpectJsonParseSuccess(bool expect_success) { 162 void SetExpectJsonParseSuccess(bool expect_success) {
163 service_->parse_json_callback_ = base::Bind(&ParseJson, expect_success); 163 service_->parse_json_callback_ = base::Bind(&ParseJson, expect_success);
164 } 164 }
165 165
166 private: 166 private:
167 base::MessageLoop message_loop_; 167 base::MessageLoop message_loop_;
168 scoped_ptr<TestingPrefServiceSimple> pref_service_; 168 scoped_ptr<TestingPrefServiceSimple> pref_service_;
169 scoped_ptr<NTPSnippetsService> service_; 169 scoped_ptr<NTPSnippetsService> service_;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } 353 }
354 354
355 TEST_F(NTPSnippetsServiceTest, RemoveExpiredContent) { 355 TEST_F(NTPSnippetsServiceTest, RemoveExpiredContent) {
356 std::string json_str(GetTestExpiredJson()); 356 std::string json_str(GetTestExpiredJson());
357 357
358 LoadFromJSONString(json_str); 358 LoadFromJSONString(json_str);
359 EXPECT_EQ(service()->size(), 0u); 359 EXPECT_EQ(service()->size(), 0u);
360 } 360 }
361 361
362 } // namespace ntp_snippets 362 } // namespace ntp_snippets
OLDNEW
« 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