Index: mojo/edk/system/core_test_base.h |
diff --git a/third_party/mojo/src/mojo/edk/system/core_test_base.h b/mojo/edk/system/core_test_base.h |
similarity index 59% |
copy from third_party/mojo/src/mojo/edk/system/core_test_base.h |
copy to mojo/edk/system/core_test_base.h |
index 5798cb6d3f0052f2cc83d88784f137547726698c..bbdaa5cf5bf83cca2fc2f72ec026c5323bea365b 100644 |
--- a/third_party/mojo/src/mojo/edk/system/core_test_base.h |
+++ b/mojo/edk/system/core_test_base.h |
@@ -2,17 +2,18 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_ |
-#define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_ |
+#ifndef MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_ |
+#define MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_ |
+#include "base/synchronization/lock.h" |
+#include "mojo/edk/embedder/embedder_internal.h" |
+#include "mojo/edk/system/test_utils.h" |
#include "mojo/public/c/system/types.h" |
#include "mojo/public/cpp/system/macros.h" |
#include "testing/gtest/include/gtest/gtest.h" |
-#include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h" |
-#include "third_party/mojo/src/mojo/edk/system/mutex.h" |
namespace mojo { |
-namespace system { |
+namespace edk { |
class Core; |
class Awakable; |
@@ -21,26 +22,20 @@ namespace test { |
class CoreTestBase_MockHandleInfo; |
-class CoreTestBase : public testing::Test { |
+class CoreTestBase : public MojoSystemTest { |
public: |
using MockHandleInfo = CoreTestBase_MockHandleInfo; |
CoreTestBase(); |
~CoreTestBase() override; |
- void SetUp() override; |
- void TearDown() override; |
- |
protected: |
// |info| must remain alive until the returned handle is closed. |
MojoHandle CreateMockHandle(MockHandleInfo* info); |
- Core* core() { return core_; } |
+ Core* core() { return mojo::edk::internal::g_core; } |
private: |
- embedder::SimplePlatformSupport platform_support_; |
- Core* core_; |
- |
MOJO_DISALLOW_COPY_AND_ASSIGN(CoreTestBase); |
}; |
@@ -88,30 +83,30 @@ class CoreTestBase_MockHandleInfo { |
void AwakableWasAdded(Awakable*); |
private: |
- mutable Mutex mutex_; |
- unsigned ctor_call_count_ MOJO_GUARDED_BY(mutex_); |
- unsigned dtor_call_count_ MOJO_GUARDED_BY(mutex_); |
- unsigned close_call_count_ MOJO_GUARDED_BY(mutex_); |
- unsigned write_message_call_count_ MOJO_GUARDED_BY(mutex_); |
- unsigned read_message_call_count_ MOJO_GUARDED_BY(mutex_); |
- unsigned write_data_call_count_ MOJO_GUARDED_BY(mutex_); |
- unsigned begin_write_data_call_count_ MOJO_GUARDED_BY(mutex_); |
- unsigned end_write_data_call_count_ MOJO_GUARDED_BY(mutex_); |
- unsigned read_data_call_count_ MOJO_GUARDED_BY(mutex_); |
- unsigned begin_read_data_call_count_ MOJO_GUARDED_BY(mutex_); |
- unsigned end_read_data_call_count_ MOJO_GUARDED_BY(mutex_); |
- unsigned add_awakable_call_count_ MOJO_GUARDED_BY(mutex_); |
- unsigned remove_awakable_call_count_ MOJO_GUARDED_BY(mutex_); |
- unsigned cancel_all_awakables_call_count_ MOJO_GUARDED_BY(mutex_); |
- |
- bool add_awakable_allowed_ MOJO_GUARDED_BY(mutex_); |
- std::vector<Awakable*> added_awakables_ MOJO_GUARDED_BY(mutex_); |
+ mutable base::Lock lock_; // Protects the following members. |
+ unsigned ctor_call_count_; |
+ unsigned dtor_call_count_; |
+ unsigned close_call_count_; |
+ unsigned write_message_call_count_; |
+ unsigned read_message_call_count_; |
+ unsigned write_data_call_count_; |
+ unsigned begin_write_data_call_count_; |
+ unsigned end_write_data_call_count_; |
+ unsigned read_data_call_count_; |
+ unsigned begin_read_data_call_count_; |
+ unsigned end_read_data_call_count_; |
+ unsigned add_awakable_call_count_; |
+ unsigned remove_awakable_call_count_; |
+ unsigned cancel_all_awakables_call_count_; |
+ |
+ bool add_awakable_allowed_; |
+ std::vector<Awakable*> added_awakables_; |
MOJO_DISALLOW_COPY_AND_ASSIGN(CoreTestBase_MockHandleInfo); |
}; |
} // namespace test |
-} // namespace system |
+} // namespace edk |
} // namespace mojo |
-#endif // THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_ |
+#endif // MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_ |