Add ICU message format support
[chromium-blink-merge.git] / ios / web / public / test / test_web_client.mm
blobd4b1e5c333ca6cbeef260c4cb0d9c3ed236f7717
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 #import "ios/web/public/test/test_web_client.h"
7 #include "base/strings/sys_string_conversions.h"
9 namespace web {
11 TestWebClient::TestWebClient()
12     : early_page_scripts_([[NSMutableDictionary alloc] init]) {
15 TestWebClient::~TestWebClient() {
18 std::string TestWebClient::GetUserAgent(bool desktop_user_agent) const {
19   return desktop_user_agent ? desktop_user_agent_ : user_agent_;
22 void TestWebClient::SetUserAgent(const std::string& user_agent,
23                                  bool is_desktop_user_agent) {
24   if (is_desktop_user_agent)
25     desktop_user_agent_ = user_agent;
26   else
27     user_agent_ = user_agent;
30 NSString* TestWebClient::GetEarlyPageScript(
31     web::WebViewType web_view_type) const {
32   NSString* result = [early_page_scripts_ objectForKey:@(web_view_type)];
33   return result ? result : @"";
36 void TestWebClient::SetEarlyPageScript(NSString* page_script,
37                                        web::WebViewType web_view_type) {
38   [early_page_scripts_ setObject:page_script forKey:@(web_view_type)];
41 }  // namespace web