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

Side by Side Diff: ppapi/tests/test_websocket.cc

Issue 9107046: PPAPI: Move PPB_ArrayBuffer out of Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix gyp file, use 1_0 Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/tests/test_websocket.h" 5 #include "ppapi/tests/test_websocket.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ppapi/c/dev/ppb_testing_dev.h" 10 #include "ppapi/c/dev/ppb_testing_dev.h"
11 #include "ppapi/c/dev/ppb_var_array_buffer_dev.h"
12 #include "ppapi/c/dev/ppb_websocket_dev.h" 11 #include "ppapi/c/dev/ppb_websocket_dev.h"
13 #include "ppapi/c/pp_errors.h" 12 #include "ppapi/c/pp_errors.h"
14 #include "ppapi/c/pp_var.h" 13 #include "ppapi/c/pp_var.h"
15 #include "ppapi/c/pp_completion_callback.h" 14 #include "ppapi/c/pp_completion_callback.h"
16 #include "ppapi/c/ppb_core.h" 15 #include "ppapi/c/ppb_core.h"
17 #include "ppapi/c/ppb_var.h" 16 #include "ppapi/c/ppb_var.h"
17 #include "ppapi/c/ppb_var_array_buffer.h"
18 #include "ppapi/cpp/dev/websocket_dev.h" 18 #include "ppapi/cpp/dev/websocket_dev.h"
19 #include "ppapi/cpp/instance.h" 19 #include "ppapi/cpp/instance.h"
20 #include "ppapi/cpp/module.h" 20 #include "ppapi/cpp/module.h"
21 #include "ppapi/tests/test_utils.h" 21 #include "ppapi/tests/test_utils.h"
22 #include "ppapi/tests/testing_instance.h" 22 #include "ppapi/tests/testing_instance.h"
23 23
24 const char kEchoServerURL[] = 24 const char kEchoServerURL[] =
25 "ws://localhost:8880/websocket/tests/hybi/echo"; 25 "ws://localhost:8880/websocket/tests/hybi/echo";
26 26
27 const char kCloseServerURL[] = 27 const char kCloseServerURL[] =
(...skipping 18 matching lines...) Expand all
46 const uint64_t kCloseFrameSize = 6; 46 const uint64_t kCloseFrameSize = 6;
47 const uint64_t kMessageFrameOverhead = 6; 47 const uint64_t kMessageFrameOverhead = 6;
48 48
49 REGISTER_TEST_CASE(WebSocket); 49 REGISTER_TEST_CASE(WebSocket);
50 50
51 bool TestWebSocket::Init() { 51 bool TestWebSocket::Init() {
52 websocket_interface_ = static_cast<const PPB_WebSocket_Dev*>( 52 websocket_interface_ = static_cast<const PPB_WebSocket_Dev*>(
53 pp::Module::Get()->GetBrowserInterface(PPB_WEBSOCKET_DEV_INTERFACE)); 53 pp::Module::Get()->GetBrowserInterface(PPB_WEBSOCKET_DEV_INTERFACE));
54 var_interface_ = static_cast<const PPB_Var*>( 54 var_interface_ = static_cast<const PPB_Var*>(
55 pp::Module::Get()->GetBrowserInterface(PPB_VAR_INTERFACE)); 55 pp::Module::Get()->GetBrowserInterface(PPB_VAR_INTERFACE));
56 arraybuffer_interface_ = static_cast<const PPB_VarArrayBuffer_Dev*>( 56 arraybuffer_interface_ = static_cast<const PPB_VarArrayBuffer*>(
57 pp::Module::Get()->GetBrowserInterface( 57 pp::Module::Get()->GetBrowserInterface(
58 PPB_VAR_ARRAY_BUFFER_DEV_INTERFACE)); 58 PPB_VAR_ARRAY_BUFFER_INTERFACE));
59 core_interface_ = static_cast<const PPB_Core*>( 59 core_interface_ = static_cast<const PPB_Core*>(
60 pp::Module::Get()->GetBrowserInterface(PPB_CORE_INTERFACE)); 60 pp::Module::Get()->GetBrowserInterface(PPB_CORE_INTERFACE));
61 if (!websocket_interface_ || !var_interface_ || !arraybuffer_interface_ || 61 if (!websocket_interface_ || !var_interface_ || !arraybuffer_interface_ ||
62 !core_interface_) 62 !core_interface_)
63 return false; 63 return false;
64 64
65 return CheckTestingInterface(); 65 return CheckTestingInterface();
66 } 66 }
67 67
68 void TestWebSocket::RunTests(const std::string& filter) { 68 void TestWebSocket::RunTests(const std::string& filter) {
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 ASSERT_EQ(kCloseCodeNormalClosure, ws.GetCloseCode()); 613 ASSERT_EQ(kCloseCodeNormalClosure, ws.GetCloseCode());
614 ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), reason.c_str())); 614 ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), reason.c_str()));
615 ASSERT_EQ(true, ws.GetCloseWasClean()); 615 ASSERT_EQ(true, ws.GetCloseWasClean());
616 ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), "")); 616 ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), ""));
617 ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), "")); 617 ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), ""));
618 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_CLOSED_DEV, ws.GetReadyState()); 618 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_CLOSED_DEV, ws.GetReadyState());
619 ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), kCloseServerURL)); 619 ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), kCloseServerURL));
620 620
621 PASS(); 621 PASS();
622 } 622 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698