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

Unified Diff: Source/modules/navigatorcontentutils/testing/NavigatorContentUtilsClientMock.cpp

Issue 293403002: Introduce mock test system for navigator content utils (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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 | « Source/modules/navigatorcontentutils/testing/NavigatorContentUtilsClientMock.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/navigatorcontentutils/testing/NavigatorContentUtilsClientMock.cpp
diff --git a/Source/modules/navigatorcontentutils/testing/NavigatorContentUtilsClientMock.cpp b/Source/modules/navigatorcontentutils/testing/NavigatorContentUtilsClientMock.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..6c988d837b1923c7b1fb7c43bd1e10d6a385eae7
--- /dev/null
+++ b/Source/modules/navigatorcontentutils/testing/NavigatorContentUtilsClientMock.cpp
@@ -0,0 +1,42 @@
+// 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.
+
+#include "config.h"
+#include "NavigatorContentUtilsClientMock.h"
+
+#include "modules/navigatorcontentutils/NavigatorContentUtilsClient.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/text/StringHash.h"
+
+namespace WebCore {
+
+void NavigatorContentUtilsClientMock::registerProtocolHandler(const String& scheme, const WebCore::KURL& baseURL,
+ const WebCore::KURL& url, const String& title)
+{
+ ProtocolInfo info;
+ info.scheme = scheme;
+ info.baseURL = baseURL;
+ info.url = url;
+ info.title = title;
+
+ m_protocolMap.set(scheme, info);
+}
+
+NavigatorContentUtilsClient::CustomHandlersState NavigatorContentUtilsClientMock::isProtocolHandlerRegistered(const String& scheme,
+ const WebCore::KURL& baseURL, const WebCore::KURL& url)
+{
+ // "declined" state is checked by NavigatorContentUtils::isProtocolHandlerRegistered() before calling this function.
+ if (m_protocolMap.contains(scheme))
+ return NavigatorContentUtilsClient::CustomHandlersRegistered;
+
+ return NavigatorContentUtilsClient::CustomHandlersNew;
+}
+
+void NavigatorContentUtilsClientMock::unregisterProtocolHandler(const String& scheme, const WebCore::KURL& baseURL,
+ const WebCore::KURL& url)
+{
+ m_protocolMap.remove(scheme);
+}
+
+} // WebCore
« no previous file with comments | « Source/modules/navigatorcontentutils/testing/NavigatorContentUtilsClientMock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698