1 // Copyright 2017 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 IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_NTP_HOME_TEST_UTILS_H_ 6 #define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_NTP_HOME_TEST_UTILS_H_ 7 8 #import <UIKit/UIKit.h> 9 10 #include "components/ntp_snippets/callbacks.h" 11 #include "url/gurl.h" 12 13 @protocol GREYMatcher; 14 15 namespace ntp_home { 16 // Returns the view corresponding to the ContentSuggestionsViewController. 17 // Returns nil if it is not in the view hierarchy. 18 UICollectionView* CollectionView(); 19 20 // Returns the view corresponding to the fake omnibox. Returns nil if it is not 21 // in the view hierarchy. 22 UIView* FakeOmnibox(); 23 } // namespace ntp_home 24 25 namespace ntp_snippets { 26 27 // Helper to return additional suggestions with a defined url when the "fetch 28 // more" action is done. 29 class AdditionalSuggestionsHelper { 30 public: 31 AdditionalSuggestionsHelper(const GURL& suggestions_url); 32 33 // Calls the |callback| with 10 suggestions, with their url set to |url_|. 34 void SendAdditionalSuggestions(FetchDoneCallback* callback); 35 36 private: 37 GURL url_; 38 }; 39 40 } // namespace ntp_snippets 41 42 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_NTP_HOME_TEST_UTILS_H_ 43