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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/tests/test_websocket.h ('k') | ppapi/thunk/interfaces_ppb_public_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ppapi/tests/test_websocket.h"
6
7 #include "ppapi/c/dev/ppb_websocket_dev.h"
8 #include "ppapi/cpp/instance.h"
9 #include "ppapi/cpp/module.h"
10 #include "ppapi/tests/testing_instance.h"
11
12 REGISTER_TEST_CASE(WebSocket);
13
14 bool TestWebSocket::Init() {
15 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/.
16 pp::Module::Get()->GetBrowserInterface(PPB_WEBSOCKET_DEV_INTERFACE));
17 return !!websocket_interface_;
18 }
19
20 void TestWebSocket::RunTests(const std::string& filter) {
21 instance_->LogTest("Create", TestCreate());
22 instance_->LogTest("IsWebSocket", TestIsWebSocket());
23 }
24
25 std::string TestWebSocket::TestCreate() {
26 PP_Resource rsrc = websocket_interface_->Create(instance_->pp_instance());
27 if (!rsrc)
28 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
29
30 PASS();
31 }
32
33 std::string TestWebSocket::TestIsWebSocket() {
34 // Test that a NULL resource isn't a websocket.
35 pp::Resource null_resource;
36 if (websocket_interface_->IsWebSocket(null_resource.pp_resource()))
37 return "Null resource was reported as a valid websocket";
38
39 PP_Resource ws = websocket_interface_->Create(instance_->pp_instance());
40 if (!websocket_interface_->IsWebSocket(ws))
41 return "websocket was reported as an invalid websocket";
42
43 PASS();
44 }
OLDNEW
« 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