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/ntp_snippets/ntp_snippets_service.h" | 5 #include "components/ntp_snippets/ntp_snippets_service.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
18 #include "base/test/histogram_tester.h" | 18 #include "base/test/histogram_tester.h" |
19 #include "base/thread_task_runner_handle.h" | 19 #include "base/threading/thread_task_runner_handle.h" |
20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
21 #include "components/image_fetcher/image_fetcher.h" | 21 #include "components/image_fetcher/image_fetcher.h" |
22 #include "components/ntp_snippets/ntp_snippet.h" | 22 #include "components/ntp_snippets/ntp_snippet.h" |
23 #include "components/ntp_snippets/ntp_snippets_fetcher.h" | 23 #include "components/ntp_snippets/ntp_snippets_fetcher.h" |
24 #include "components/ntp_snippets/ntp_snippets_scheduler.h" | 24 #include "components/ntp_snippets/ntp_snippets_scheduler.h" |
25 #include "components/ntp_snippets/switches.h" | 25 #include "components/ntp_snippets/switches.h" |
26 #include "components/prefs/testing_pref_service.h" | 26 #include "components/prefs/testing_pref_service.h" |
27 #include "components/signin/core/browser/account_tracker_service.h" | 27 #include "components/signin/core/browser/account_tracker_service.h" |
28 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" | 28 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" |
29 #include "components/signin/core/browser/fake_signin_manager.h" | 29 #include "components/signin/core/browser/fake_signin_manager.h" |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 EXPECT_THAT( | 765 EXPECT_THAT( |
766 tester.GetAllSamples("NewTabPage.Snippets.NumArticlesZeroDueToDiscarded"), | 766 tester.GetAllSamples("NewTabPage.Snippets.NumArticlesZeroDueToDiscarded"), |
767 ElementsAre(base::Bucket(/*min=*/1, /*count=*/1))); | 767 ElementsAre(base::Bucket(/*min=*/1, /*count=*/1))); |
768 // Recreating the service and loading from prefs shouldn't count as fetched | 768 // Recreating the service and loading from prefs shouldn't count as fetched |
769 // articles. | 769 // articles. |
770 EXPECT_CALL(mock_scheduler(), Schedule(_, _, _, _)).Times(1); | 770 EXPECT_CALL(mock_scheduler(), Schedule(_, _, _, _)).Times(1); |
771 CreateSnippetsService(/*enabled=*/true); | 771 CreateSnippetsService(/*enabled=*/true); |
772 tester.ExpectTotalCount("NewTabPage.Snippets.NumArticlesFetched", 4); | 772 tester.ExpectTotalCount("NewTabPage.Snippets.NumArticlesFetched", 4); |
773 } | 773 } |
774 } // namespace ntp_snippets | 774 } // namespace ntp_snippets |
OLD | NEW |