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

Unified Diff: ios/web/public/test/test_web_client.h

Issue 1043243003: Upstream most of ios/web/net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove accidentally-added clients Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/public/cert_store.h ('k') | ios/web/public/test/test_web_client.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/public/test/test_web_client.h
diff --git a/ios/web/public/test/test_web_client.h b/ios/web/public/test/test_web_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..b6eb16774713867315933cf18203fca41f9464b7
--- /dev/null
+++ b/ios/web/public/test/test_web_client.h
@@ -0,0 +1,45 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEB_TEST_WEB_PUBLIC_TEST_TEST_WEB_CLIENT_H_
+#define WEB_TEST_WEB_PUBLIC_TEST_TEST_WEB_CLIENT_H_
+
+#import <Foundation/Foundation.h>
+
+#include "base/compiler_specific.h"
+#include "base/mac/scoped_nsobject.h"
+#include "base/memory/scoped_ptr.h"
+#include "ios/web/public/web_client.h"
+
+namespace web {
+
+class WebViewFactory;
+
+// A WebClient used for testing purposes.
+class TestWebClient : public web::WebClient {
+ public:
+ TestWebClient();
+ ~TestWebClient() override;
+ // WebClient implementation.
+ std::string GetUserAgent(bool is_desktop_user_agent) const override;
+ NSString* GetEarlyPageScript(web::WebViewType web_view_type) const override;
+
+ // Changes the user agent for testing purposes. Passing true
+ // for |is_desktop_user_agent| affects the result of GetUserAgent(true) call.
+ // Passing false affects the result of GetUserAgent(false).
+ void SetUserAgent(const std::string& user_agent, bool is_desktop_user_agent);
+
+ // Changes Early Page Script for testing purposes.
+ void SetEarlyPageScript(NSString* page_script,
+ web::WebViewType web_view_type);
+
+ private:
+ std::string user_agent_;
+ std::string desktop_user_agent_;
+ base::scoped_nsobject<NSMutableDictionary> early_page_scripts_;
+};
+
+} // namespace web
+
+#endif // WEB_TEST_WEB_PUBLIC_TEST_TEST_WEB_CLIENT_H_
« no previous file with comments | « ios/web/public/cert_store.h ('k') | ios/web/public/test/test_web_client.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698