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.
5 #ifndef WEB_TEST_WEB_PUBLIC_TEST_TEST_WEB_CLIENT_H_
6 #define WEB_TEST_WEB_PUBLIC_TEST_TEST_WEB_CLIENT_H_
8 #import <Foundation/Foundation.h>
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"
19 // A WebClient used for testing purposes.
20 class TestWebClient
: public web::WebClient
{
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
;
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
);
33 // Changes Early Page Script for testing purposes.
34 void SetEarlyPageScript(NSString
* page_script
,
35 web::WebViewType web_view_type
);
38 std::string user_agent_
;
39 std::string desktop_user_agent_
;
40 base::scoped_nsobject
<NSMutableDictionary
> early_page_scripts_
;
45 #endif // WEB_TEST_WEB_PUBLIC_TEST_TEST_WEB_CLIENT_H_