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

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

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
Index: Source/modules/navigatorcontentutils/testing/NavigatorContentUtilsClientMock.h
diff --git a/Source/modules/navigatorcontentutils/NavigatorContentUtilsClient.h b/Source/modules/navigatorcontentutils/testing/NavigatorContentUtilsClientMock.h
similarity index 62%
copy from Source/modules/navigatorcontentutils/NavigatorContentUtilsClient.h
copy to Source/modules/navigatorcontentutils/testing/NavigatorContentUtilsClientMock.h
index 3348289d72e5166e883091ede304bf0dbd610e5b..59e025a2f862f839cccb10d59d1bd2db958a1f3c 100644
--- a/Source/modules/navigatorcontentutils/NavigatorContentUtilsClient.h
+++ b/Source/modules/navigatorcontentutils/testing/NavigatorContentUtilsClientMock.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Samsung Electronics. All Rights Reserved.
+ * Copyright (C) 2014 Samsung Electronics. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,33 +23,40 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef NavigatorContentUtilsClient_h
-#define NavigatorContentUtilsClient_h
+#ifndef NavigatorContentUtilsClientMock_h
+#define NavigatorContentUtilsClientMock_h
+#include "modules/navigatorcontentutils/NavigatorContentUtilsClient.h"
#include "platform/weborigin/KURL.h"
+#include "wtf/HashSet.h"
+#include "wtf/OwnPtr.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
-class Page;
-
-class NavigatorContentUtilsClient {
+// Provides a mock object for the navigatorcontentutils client.
+class NavigatorContentUtilsClientMock : public NavigatorContentUtilsClient {
public:
- virtual ~NavigatorContentUtilsClient() { }
- virtual void registerProtocolHandler(const String& scheme, const KURL& baseURL, const KURL&, const String& title) = 0;
+ NavigatorContentUtilsClientMock() { }
+ virtual ~NavigatorContentUtilsClientMock() { }
- enum CustomHandlersState {
- CustomHandlersNew,
- CustomHandlersRegistered,
- CustomHandlersDeclined
- };
+ virtual void registerProtocolHandler(const String& scheme, const KURL& baseURL, const KURL&, const String& title);
- virtual CustomHandlersState isProtocolHandlerRegistered(const String& scheme, const KURL& baseURL, const KURL&) = 0;
- virtual void unregisterProtocolHandler(const String& scheme, const KURL& baseURL, const KURL&) = 0;
-};
+ virtual CustomHandlersState isProtocolHandlerRegistered(const String& scheme, const KURL& baseURL, const KURL&);
+ virtual void unregisterProtocolHandler(const String& scheme, const KURL& baseURL, const KURL&);
-void provideNavigatorContentUtilsTo(Page&, PassOwnPtr<NavigatorContentUtilsClient>);
+private:
+ typedef struct {
+ String scheme;
+ WebCore::KURL baseURL;
+ WebCore::KURL url;
+ String title;
+ } ProtocolInfo;
+
+ typedef HashMap<String, ProtocolInfo> RegisteredProtocolMap;
+ RegisteredProtocolMap m_protocolMap;
+};
}
-#endif // NavigatorContentUtilsClient_h
+#endif // NavigatorContentUtilsClientMock_h

Powered by Google App Engine
This is Rietveld 408576698