MCPcopy Create free account
hub / github.com/deviceplug/btleplug / test_waker_close_wake

Function test_waker_close_wake

src/droidplug/jni_utils/task.rs:109–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107
108 #[test]
109 fn test_waker_close_wake() {
110 test_utils::JVM_ENV.with(|env| {
111 let data = Arc::new(test_utils::TestWakerData::new());
112 assert_eq!(Arc::strong_count(&data), 1);
113 assert_eq!(data.value(), false);
114
115 let waker = test_utils::test_waker(&data);
116 assert_eq!(Arc::strong_count(&data), 2);
117 assert_eq!(data.value(), false);
118
119 let jwaker = super::waker(env, waker).unwrap();
120 assert_eq!(Arc::strong_count(&data), 2);
121 assert_eq!(data.value(), false);
122
123 env.call_method(jwaker, "close", "()V", &[]).unwrap();
124 assert_eq!(Arc::strong_count(&data), 1);
125 assert_eq!(data.value(), false);
126
127 env.call_method(jwaker, "wake", "()V", &[]).unwrap();
128 assert_eq!(Arc::strong_count(&data), 1);
129 assert_eq!(data.value(), false);
130 });
131 }
132}

Callers

nothing calls this directly

Calls 2

test_wakerFunction · 0.85
wakerFunction · 0.85

Tested by

no test coverage detected