OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 WEB_TEST_WEB_PUBLIC_TEST_TEST_WEB_CLIENT_H_ |
| 6 #define WEB_TEST_WEB_PUBLIC_TEST_TEST_WEB_CLIENT_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 #include "base/compiler_specific.h" |
| 11 #include "base/mac/scoped_nsobject.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "ios/web/public/web_client.h" |
| 14 |
| 15 namespace web { |
| 16 |
| 17 class WebViewFactory; |
| 18 |
| 19 // A WebClient used for testing purposes. |
| 20 class TestWebClient : public web::WebClient { |
| 21 public: |
| 22 TestWebClient(); |
| 23 ~TestWebClient() override; |
| 24 // WebClient implementation. |
| 25 std::string GetUserAgent(bool is_desktop_user_agent) const override; |
| 26 NSString* GetEarlyPageScript(web::WebViewType web_view_type) const override; |
| 27 |
| 28 // Changes the user agent for testing purposes. Passing true |
| 29 // for |is_desktop_user_agent| affects the result of GetUserAgent(true) call. |
| 30 // Passing false affects the result of GetUserAgent(false). |
| 31 void SetUserAgent(const std::string& user_agent, bool is_desktop_user_agent); |
| 32 |
| 33 // Changes Early Page Script for testing purposes. |
| 34 void SetEarlyPageScript(NSString* page_script, |
| 35 web::WebViewType web_view_type); |
| 36 |
| 37 private: |
| 38 std::string user_agent_; |
| 39 std::string desktop_user_agent_; |
| 40 base::scoped_nsobject<NSMutableDictionary> early_page_scripts_; |
| 41 }; |
| 42 |
| 43 } // namespace web |
| 44 |
| 45 #endif // WEB_TEST_WEB_PUBLIC_TEST_TEST_WEB_CLIENT_H_ |
OLD | NEW |