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

Unified Diff: ppapi/tests/test_transport.cc

Issue 6478018: Basic implementation of Pepper Transport API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 10 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
« no previous file with comments | « ppapi/tests/test_transport.h ('k') | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_transport.cc
diff --git a/ppapi/tests/test_transport.cc b/ppapi/tests/test_transport.cc
index bcb7552c990f1892f8d0b6d4ac58b07d39562646..72ead1b969ea5a0d530c25a061983979ebdb57d2 100644
--- a/ppapi/tests/test_transport.cc
+++ b/ppapi/tests/test_transport.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -9,11 +9,11 @@
#include <string>
#include "ppapi/c/dev/ppb_testing_dev.h"
-#include "ppapi/c/dev/ppb_transport_dev.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/cpp/completion_callback.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/dev/transport_dev.h"
#include "ppapi/tests/test_utils.h"
#include "ppapi/tests/testing_instance.h"
@@ -26,11 +26,42 @@ bool TestTransport::Init() {
}
void TestTransport::RunTest() {
- RUN_TEST(FirstTransport);
+ RUN_TEST(Basics);
// TODO(juberti): more Transport tests here...
}
-std::string TestTransport::TestFirstTransport() {
- // TODO(juberti): actual test
+std::string TestTransport::TestBasics() {
+ pp::Transport_Dev transport1(instance_, "test", "");
+ pp::Transport_Dev transport2(instance_, "test", "");
+
+ TestCompletionCallback connect_cb1(instance_->pp_instance());
+ TestCompletionCallback connect_cb2(instance_->pp_instance());
+ ASSERT_EQ(transport1.Connect(connect_cb1), PP_ERROR_WOULDBLOCK);
+ ASSERT_EQ(transport2.Connect(connect_cb2), PP_ERROR_WOULDBLOCK);
+
+ pp::Var address1;
+ pp::Var address2;
+ TestCompletionCallback next_address_cb1(instance_->pp_instance());
+ TestCompletionCallback next_address_cb2(instance_->pp_instance());
+ ASSERT_EQ(transport1.GetNextAddress(&address1, next_address_cb1),
+ PP_ERROR_WOULDBLOCK);
+ ASSERT_EQ(transport2.GetNextAddress(&address2, next_address_cb2),
+ PP_ERROR_WOULDBLOCK);
+ ASSERT_EQ(next_address_cb1.WaitForResult(), 0);
+ ASSERT_EQ(next_address_cb2.WaitForResult(), 0);
+ ASSERT_EQ(transport1.GetNextAddress(&address1, next_address_cb1), PP_OK);
+ ASSERT_EQ(transport2.GetNextAddress(&address2, next_address_cb2), PP_OK);
+
+ ASSERT_EQ(transport1.ReceiveRemoteAddress(address2), 0);
+ ASSERT_EQ(transport2.ReceiveRemoteAddress(address1), 0);
+
+ ASSERT_EQ(connect_cb1.WaitForResult(), 0);
+ ASSERT_EQ(connect_cb2.WaitForResult(), 0);
+
+ ASSERT_TRUE(transport1.IsWritable());
+ ASSERT_TRUE(transport2.IsWritable());
+
+ // TODO(sergeyu): Verify that data can be sent/received.
+
PASS();
}
« no previous file with comments | « ppapi/tests/test_transport.h ('k') | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698