summaryrefslogtreecommitdiffstats
path: root/ppapi/tests
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-20 23:46:41 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-20 23:46:41 +0000
commit6de9070e8a48d7faf1d723c5fd40ed29222c7125 (patch)
treea129ec5f371d9cd072053313c56b96b051f9706c /ppapi/tests
parent061239ca0a4d26d8d88ca2db94cb1a330dae4928 (diff)
downloadchromium_src-6de9070e8a48d7faf1d723c5fd40ed29222c7125.zip
chromium_src-6de9070e8a48d7faf1d723c5fd40ed29222c7125.tar.gz
chromium_src-6de9070e8a48d7faf1d723c5fd40ed29222c7125.tar.bz2
Revert 127797 - Add NetworkListObserver utility class.
BUG=114808 Review URL: http://codereview.chromium.org/9696051 TBR=sergeyu@chromium.org Review URL: https://chromiumcodereview.appspot.com/9801004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127837 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests')
-rw-r--r--ppapi/tests/test_network_monitor_private.cc52
-rw-r--r--ppapi/tests/test_network_monitor_private.h8
2 files changed, 10 insertions, 50 deletions
diff --git a/ppapi/tests/test_network_monitor_private.cc b/ppapi/tests/test_network_monitor_private.cc
index 6583cc4..fa87ec1 100644
--- a/ppapi/tests/test_network_monitor_private.cc
+++ b/ppapi/tests/test_network_monitor_private.cc
@@ -6,14 +6,12 @@
#include <string.h>
-#include "ppapi/cpp/instance_handle.h"
-#include "ppapi/cpp/module.h"
#include "ppapi/cpp/private/net_address_private.h"
#include "ppapi/cpp/private/network_list_private.h"
#include "ppapi/cpp/private/network_monitor_private.h"
#include "ppapi/tests/testing_instance.h"
#include "ppapi/tests/test_utils.h"
-#include "ppapi/utility/private/network_list_observer_private.h"
+#include "ppapi/cpp/module.h"
REGISTER_TEST_CASE(NetworkMonitorPrivate);
@@ -54,22 +52,6 @@ void TestCallback(void* user_data, PP_Resource network_list) {
static_cast<pp::CompletionCallback>(data->completion_callback).Run(PP_OK);
}
-
-class TestNetworkListObserver : public pp::NetworkListObserverPrivate {
- public:
- explicit TestNetworkListObserver(const pp::InstanceHandle& instance)
- : pp::NetworkListObserverPrivate(instance),
- completion_callback(instance.pp_instance()) {
- }
- virtual void OnNetworkListChanged(const pp::NetworkListPrivate& list) {
- current_list = list;
- static_cast<pp::CompletionCallback>(completion_callback).Run(PP_OK);
- }
-
- pp::NetworkListPrivate current_list;
- TestCompletionCallback completion_callback;
-};
-
} // namespace
TestNetworkMonitorPrivate::TestNetworkMonitorPrivate(TestingInstance* instance)
@@ -87,17 +69,12 @@ void TestNetworkMonitorPrivate::RunTests(const std::string& filter) {
RUN_TEST_FORCEASYNC_AND_NOT(Basic, filter);
RUN_TEST_FORCEASYNC_AND_NOT(2Monitors, filter);
RUN_TEST_FORCEASYNC_AND_NOT(DeleteInCallback, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(ListObserver, filter);
-}
-
-std::string TestNetworkMonitorPrivate::VerifyNetworkListResource(
- PP_Resource network_list_resource) {
- pp::NetworkListPrivate network_list(network_list_resource);
- return VerifyNetworkList(network_list);
}
std::string TestNetworkMonitorPrivate::VerifyNetworkList(
- const pp::NetworkListPrivate& network_list) {
+ PP_Resource network_resource) {
+ pp::NetworkListPrivate network_list(network_resource);
+
// Verify that there is at least one network interface.
size_t count = network_list.GetCount();
ASSERT_TRUE(count >= 1U);
@@ -160,7 +137,7 @@ std::string TestNetworkMonitorPrivate::VerifyNetworkList(
const char kFillValue = 123;
memset(&addresses.front(), kFillValue,
addresses.size() * sizeof(PP_NetAddress_Private));
- int result = interface->GetIpAddresses(network_list.pp_resource(), 0,
+ int result = interface->GetIpAddresses(network_resource, 0,
&addresses.front(), i);
ASSERT_EQ(result, static_cast<int>(address_count));
@@ -183,8 +160,7 @@ std::string TestNetworkMonitorPrivate::TestBasic() {
ASSERT_EQ(callback_data.completion_callback.WaitForResult(), PP_OK);
ASSERT_EQ(callback_data.call_counter, 1);
- ASSERT_SUBTEST_SUCCESS(
- VerifyNetworkListResource(callback_data.list_resource));
+ ASSERT_SUBTEST_SUCCESS(VerifyNetworkList(callback_data.list_resource));
PASS();
}
@@ -197,8 +173,7 @@ std::string TestNetworkMonitorPrivate::Test2Monitors() {
ASSERT_EQ(callback_data.completion_callback.WaitForResult(), PP_OK);
ASSERT_EQ(callback_data.call_counter, 1);
- ASSERT_SUBTEST_SUCCESS(
- VerifyNetworkListResource(callback_data.list_resource));
+ ASSERT_SUBTEST_SUCCESS(VerifyNetworkList(callback_data.list_resource));
CallbackData callback_data_2(instance_->pp_instance());
@@ -207,8 +182,7 @@ std::string TestNetworkMonitorPrivate::Test2Monitors() {
ASSERT_EQ(callback_data_2.completion_callback.WaitForResult(), PP_OK);
ASSERT_EQ(callback_data_2.call_counter, 1);
- ASSERT_SUBTEST_SUCCESS(
- VerifyNetworkListResource(callback_data_2.list_resource));
+ ASSERT_SUBTEST_SUCCESS(VerifyNetworkList(callback_data_2.list_resource));
PASS();
}
@@ -224,15 +198,7 @@ std::string TestNetworkMonitorPrivate::TestDeleteInCallback() {
ASSERT_EQ(callback_data.completion_callback.WaitForResult(), PP_OK);
ASSERT_EQ(callback_data.call_counter, 1);
- ASSERT_SUBTEST_SUCCESS(
- VerifyNetworkListResource(callback_data.list_resource));
-
- PASS();
-}
+ ASSERT_SUBTEST_SUCCESS(VerifyNetworkList(callback_data.list_resource));
-std::string TestNetworkMonitorPrivate::TestListObserver() {
- TestNetworkListObserver observer(instance_);
- ASSERT_EQ(observer.completion_callback.WaitForResult(), PP_OK);
- ASSERT_SUBTEST_SUCCESS(VerifyNetworkList(observer.current_list));
PASS();
}
diff --git a/ppapi/tests/test_network_monitor_private.h b/ppapi/tests/test_network_monitor_private.h
index 38016d2..00a856a 100644
--- a/ppapi/tests/test_network_monitor_private.h
+++ b/ppapi/tests/test_network_monitor_private.h
@@ -10,10 +10,6 @@
#include "ppapi/c/pp_stdint.h"
#include "ppapi/tests/test_case.h"
-namespace pp {
-class NetworkListPrivate;
-} // namespace pp
-
class TestNetworkMonitorPrivate : public TestCase {
public:
explicit TestNetworkMonitorPrivate(TestingInstance* instance);
@@ -26,10 +22,8 @@ class TestNetworkMonitorPrivate : public TestCase {
std::string TestBasic();
std::string Test2Monitors();
std::string TestDeleteInCallback();
- std::string TestListObserver();
- std::string VerifyNetworkListResource(PP_Resource network_resource);
- std::string VerifyNetworkList(const pp::NetworkListPrivate& network_list);
+ std::string VerifyNetworkList(PP_Resource network_resource);
};
#endif // PAPPI_TESTS_TEST_NETWORK_MONITOR_PRIVATE_H_