forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
On host targets, add dependencies on host unit test executables. (flu…
- Loading branch information
1 parent
64dcfc6
commit c4bd577
Showing
7 changed files
with
73 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2016 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. | ||
|
||
#include <thread> | ||
|
||
#include "flutter/synchronization/semaphore.h" | ||
#include "gtest/gtest.h" | ||
|
||
TEST(SemaphoreTest, SimpleValidity) { | ||
flutter::Semaphore sem(100); | ||
ASSERT_TRUE(sem.IsValid()); | ||
} | ||
|
||
TEST(SemaphoreTest, WaitOnZero) { | ||
flutter::Semaphore sem(0); | ||
ASSERT_FALSE(sem.TryWait()); | ||
} | ||
|
||
TEST(SemaphoreTest, WaitOnZeroSignalThenWait) { | ||
flutter::Semaphore sem(0); | ||
ASSERT_FALSE(sem.TryWait()); | ||
std::thread thread([&sem]() { sem.Signal(); }); | ||
thread.join(); | ||
ASSERT_TRUE(sem.TryWait()); | ||
ASSERT_FALSE(sem.TryWait()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright 2016 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. | ||
|
||
source_set("testing") { | ||
sources = [ | ||
"//flutter/testing/run_all_unittests.cc", | ||
] | ||
|
||
public_deps = [ | ||
"//third_party/gtest", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright 2016 The Fuchsia Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "gtest/gtest.h" | ||
|
||
int main(int argc, char** argv) { | ||
testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_TESTS(); | ||
} |