OLD | NEW |
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_network_monitor_private.h" | 5 #include "ppapi/tests/test_network_monitor_private.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "ppapi/cpp/instance_handle.h" | 9 #include "ppapi/cpp/instance_handle.h" |
10 #include "ppapi/cpp/module.h" | 10 #include "ppapi/cpp/module.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 data->network_list = pp::NetworkListPrivate(pp::PASS_REF, pp_network_list); | 42 data->network_list = pp::NetworkListPrivate(pp::PASS_REF, pp_network_list); |
43 | 43 |
44 if (data->delete_monitor) | 44 if (data->delete_monitor) |
45 delete data->monitor; | 45 delete data->monitor; |
46 | 46 |
47 if (data->call_counter == 1) | 47 if (data->call_counter == 1) |
48 data->event.Signal(); | 48 data->event.Signal(); |
49 } | 49 } |
50 | 50 |
51 | |
52 class TestNetworkListObserver : public pp::NetworkListObserverPrivate { | 51 class TestNetworkListObserver : public pp::NetworkListObserverPrivate { |
53 public: | 52 public: |
54 explicit TestNetworkListObserver(const pp::InstanceHandle& instance) | 53 explicit TestNetworkListObserver(const pp::InstanceHandle& instance) |
55 : pp::NetworkListObserverPrivate(instance), | 54 : pp::NetworkListObserverPrivate(instance), |
56 event(instance.pp_instance()) { | 55 event(instance.pp_instance()) { |
57 } | 56 } |
58 virtual void OnNetworkListChanged(const pp::NetworkListPrivate& list) { | 57 virtual void OnNetworkListChanged(const pp::NetworkListPrivate& list) { |
59 current_list = list; | 58 current_list = list; |
60 event.Signal(); | 59 event.Signal(); |
61 } | 60 } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 212 |
214 PASS(); | 213 PASS(); |
215 } | 214 } |
216 | 215 |
217 std::string TestNetworkMonitorPrivate::TestListObserver() { | 216 std::string TestNetworkMonitorPrivate::TestListObserver() { |
218 TestNetworkListObserver observer(instance_); | 217 TestNetworkListObserver observer(instance_); |
219 observer.event.Wait(); | 218 observer.event.Wait(); |
220 ASSERT_SUBTEST_SUCCESS(VerifyNetworkList(observer.current_list)); | 219 ASSERT_SUBTEST_SUCCESS(VerifyNetworkList(observer.current_list)); |
221 PASS(); | 220 PASS(); |
222 } | 221 } |
OLD | NEW |