Chromium Code Reviews| 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..2e0da71121335c2728e7702d84ef2a4a23b34e26 |
| --- /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 was checked by NavigatorContentUtils::isProtocolHandlerRegistered() before calling this function. |
|
haraken
2014/06/02 03:43:29
I don't fully understand this. Who calls Navigator
gyuyoung-inactive
2014/06/02 05:14:37
isProtocolHandlerRegistered() is one of NavigatorC
|
| + 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 |