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

Unified Diff: webrtc/base/platform_thread_unittest.cc

Issue 1908373002: Update PlatformThread to support a couple of new properties. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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 | « webrtc/base/platform_thread.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/platform_thread_unittest.cc
diff --git a/webrtc/base/platform_thread_unittest.cc b/webrtc/base/platform_thread_unittest.cc
index f9db8e34a305f3fd821280f7549f942742632c78..a0d03bfbefb1956d23f939b91b55b5a687d5f8ad 100644
--- a/webrtc/base/platform_thread_unittest.cc
+++ b/webrtc/base/platform_thread_unittest.cc
@@ -14,31 +14,36 @@
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/system_wrappers/include/sleep.h"
-namespace webrtc {
-
+namespace rtc {
+namespace {
// Function that does nothing, and reports success.
bool NullRunFunction(void* obj) {
- SleepMs(0); // Hand over timeslice, prevents busy looping.
+ webrtc::SleepMs(0); // Hand over timeslice, prevents busy looping.
return true;
}
-TEST(PlatformThreadTest, StartStop) {
- rtc::PlatformThread thread(&NullRunFunction, nullptr, "PlatformThreadTest");
- thread.Start();
- thread.Stop();
-}
-
// Function that sets a boolean.
bool SetFlagRunFunction(void* obj) {
bool* obj_as_bool = static_cast<bool*>(obj);
*obj_as_bool = true;
- SleepMs(0); // Hand over timeslice, prevents busy looping.
+ webrtc::SleepMs(0); // Hand over timeslice, prevents busy looping.
return true;
}
+} // namespace
+
+TEST(PlatformThreadTest, StartStop) {
+ PlatformThread thread(&NullRunFunction, nullptr, "PlatformThreadTest");
+ EXPECT_TRUE(thread.name() == "PlatformThreadTest");
+ EXPECT_TRUE(thread.GetThreadRef() == 0);
+ thread.Start();
+ EXPECT_TRUE(thread.GetThreadRef() != 0);
+ thread.Stop();
+ EXPECT_TRUE(thread.GetThreadRef() == 0);
+}
perkj_webrtc 2016/04/22 13:32:20 To show the usage- can you add another test with t
tommi 2016/04/22 14:47:11 Done.
TEST(PlatformThreadTest, RunFunctionIsCalled) {
bool flag = false;
- rtc::PlatformThread thread(&SetFlagRunFunction, &flag, "RunFunctionIsCalled");
+ PlatformThread thread(&SetFlagRunFunction, &flag, "RunFunctionIsCalled");
thread.Start();
// At this point, the flag may be either true or false.
@@ -47,5 +52,4 @@ TEST(PlatformThreadTest, RunFunctionIsCalled) {
// We expect the thread to have run at least once.
EXPECT_TRUE(flag);
}
-
-} // namespace webrtc
+} // rtc
« no previous file with comments | « webrtc/base/platform_thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698