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

Side by Side Diff: components/ntp_snippets/mock_content_suggestions_provider_observer.h

Issue 2228553003: a provider of Physical Web pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format Created 4 years, 4 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 2016 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 #ifndef COMPONENTS_NTP_SNIPPETS_MOCK_CONTENT_SUGGESTIONS_PROVIDER_OBSERVER_H_
6 #define COMPONENTS_NTP_SNIPPETS_MOCK_CONTENT_SUGGESTIONS_PROVIDER_OBSERVER_H_
7
8 #include <list>
9 #include <vector>
10
11 #include "components/ntp_snippets/content_suggestions_provider.h"
12 #include "testing/gmock/include/gmock/gmock.h"
13
14 namespace ntp_snippets {
15
16 class MockContentSuggestionsProviderObserver
17 : public ContentSuggestionsProvider::Observer {
18 public:
19 MockContentSuggestionsProviderObserver();
20 ~MockContentSuggestionsProviderObserver();
21
22 // Call of this function is redirected to the mock function OnNewSuggestions
23 // which takes const list of suggestions. We do this trick so that the
24 // MOCK_METHOD behaves the same way in tests as the actual method and we can
25 // keep this gMock issue limited to the mock class. MOCK_METHOD cannot be
26 // applied here directly, since gMock does not support movable-only types
27 // such as ContentSuggestion.
28 void OnNewSuggestions(ContentSuggestionsProvider* provider,
29 Category category,
30 std::vector<ContentSuggestion> suggestions) override;
31
32 MOCK_METHOD3(OnNewSuggestions,
33 void(ContentSuggestionsProvider* provider,
34 Category category,
35 const std::list<ContentSuggestion>& suggestions));
Bernhard Bauer 2016/08/12 12:55:19 If you use a vector here, could you just directly
vitaliii 2016/08/12 13:32:46 Let's consider all possible cases: - No |void OnN
Bernhard Bauer 2016/08/12 13:49:06 Sorry, what I meant was calling the mock method fr
vitaliii 2016/08/16 07:31:21 Indeed, I tried this before. Tim's argument was th
36 MOCK_METHOD3(OnCategoryStatusChanged,
37 void(ContentSuggestionsProvider* provider,
38 Category category,
39 CategoryStatus new_status));
40 };
41
42 } // namespace ntp_snippets
43
44 #endif // COMPONENTS_NTP_SNIPPETS_MOCK_CONTENT_SUGGESTIONS_PROVIDER_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698