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

Unified Diff: ppapi/tests/test_websocket.cc

Issue 8571002: WebSocket Pepper API: in process API base implementation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test name was wrong Created 9 years, 1 month 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 | « ppapi/tests/test_websocket.h ('k') | ppapi/thunk/interfaces_ppb_public_dev.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_websocket.cc
diff --git a/ppapi/tests/test_websocket.cc b/ppapi/tests/test_websocket.cc
new file mode 100644
index 0000000000000000000000000000000000000000..eb83f60fbb76067469a32b209a84e94e3296a777
--- /dev/null
+++ b/ppapi/tests/test_websocket.cc
@@ -0,0 +1,44 @@
+// Copyright (c) 2011 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 "ppapi/tests/test_websocket.h"
+
+#include "ppapi/c/dev/ppb_websocket_dev.h"
+#include "ppapi/cpp/instance.h"
+#include "ppapi/cpp/module.h"
+#include "ppapi/tests/testing_instance.h"
+
+REGISTER_TEST_CASE(WebSocket);
+
+bool TestWebSocket::Init() {
+ websocket_interface_ = reinterpret_cast<PPB_WebSocket_Dev const*>(
dmichael (off chromium) 2011/11/18 16:22:21 static_cast (okay to do in next CL)
Takashi Toyoshima 2011/11/19 00:01:19 Fixed in http://codereview.chromium.org/8558017/.
+ pp::Module::Get()->GetBrowserInterface(PPB_WEBSOCKET_DEV_INTERFACE));
+ return !!websocket_interface_;
+}
+
+void TestWebSocket::RunTests(const std::string& filter) {
+ instance_->LogTest("Create", TestCreate());
+ instance_->LogTest("IsWebSocket", TestIsWebSocket());
+}
+
+std::string TestWebSocket::TestCreate() {
+ PP_Resource rsrc = websocket_interface_->Create(instance_->pp_instance());
+ if (!rsrc)
+ return "Could not create websocket via C interface";
dmichael (off chromium) 2011/11/18 16:22:21 For what it's worth, we usually just user the 'ASS
Takashi Toyoshima 2011/11/19 00:01:19 Also fixed in http://codereview.chromium.org/85580
+
+ PASS();
+}
+
+std::string TestWebSocket::TestIsWebSocket() {
+ // Test that a NULL resource isn't a websocket.
+ pp::Resource null_resource;
+ if (websocket_interface_->IsWebSocket(null_resource.pp_resource()))
+ return "Null resource was reported as a valid websocket";
+
+ PP_Resource ws = websocket_interface_->Create(instance_->pp_instance());
+ if (!websocket_interface_->IsWebSocket(ws))
+ return "websocket was reported as an invalid websocket";
+
+ PASS();
+}
« no previous file with comments | « ppapi/tests/test_websocket.h ('k') | ppapi/thunk/interfaces_ppb_public_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698