diff --git a/firestore/integration_test_internal/src/android/firestore_integration_test_android.h b/firestore/integration_test_internal/src/android/firestore_integration_test_android.h index 10ee990031..91d3f7a85f 100644 --- a/firestore/integration_test_internal/src/android/firestore_integration_test_android.h +++ b/firestore/integration_test_internal/src/android/firestore_integration_test_android.h @@ -49,7 +49,8 @@ void PrintTo(const Global& object, std::ostream* os) { * jni::Local object2 = env.NewStringUtf("string"); * EXPECT_THAT(object1, JavaEq(object2)); */ -MATCHER_P(JavaEq, object, +MATCHER_P(JavaEq, + object, std::string("compares ") + (negation ? "unequal" : "equal") + " using .equals() to a " + ToDebugString(object)) { jni::Env env; diff --git a/firestore/integration_test_internal/src/android/promise_android_test.cc b/firestore/integration_test_internal/src/android/promise_android_test.cc index 452e1c8b6d..1e9ac52728 100644 --- a/firestore/integration_test_internal/src/android/promise_android_test.cc +++ b/firestore/integration_test_internal/src/android/promise_android_test.cc @@ -101,10 +101,12 @@ class PromiseTest : public FirestoreAndroidIntegrationTest { // latter specialization provides access to the "result" specified to // `CompleteWith`. template -class TestCompletionBase : public Promise::Completion { public: - void CompleteWith(Error error_code, const char* error_message, + void CompleteWith(Error error_code, + const char* error_message, PublicType* result) override { MutexLock lock(mutex_); FIREBASE_ASSERT(invocation_count_ == 0); diff --git a/firestore/integration_test_internal/src/firestore_integration_test.cc b/firestore/integration_test_internal/src/firestore_integration_test.cc index 3ed35e6ee9..ec56570def 100644 --- a/firestore/integration_test_internal/src/firestore_integration_test.cc +++ b/firestore/integration_test_internal/src/firestore_integration_test.cc @@ -308,9 +308,7 @@ std::string FirestoreIntegrationTest::DescribeFailedFuture( std::to_string(future.error()) + "): " + future.error_message(); } -bool ProcessEvents(int msec) { - return app_framework::ProcessEvents(msec); -} +bool ProcessEvents(int msec) { return app_framework::ProcessEvents(msec); } } // namespace firestore } // namespace firebase diff --git a/firestore/integration_test_internal/src/firestore_integration_test.h b/firestore/integration_test_internal/src/firestore_integration_test.h index d60eac8fd2..b801f80202 100644 --- a/firestore/integration_test_internal/src/firestore_integration_test.h +++ b/firestore/integration_test_internal/src/firestore_integration_test.h @@ -57,11 +57,9 @@ class EventAccumulator; template class TestEventListener : public EventListener { public: - explicit TestEventListener(std::string name) : name_(std::move(name)) { - } + explicit TestEventListener(std::string name) : name_(std::move(name)) {} - ~TestEventListener() override { - } + ~TestEventListener() override {} void OnEvent(const T& value, Error error_code, @@ -137,9 +135,7 @@ class TestEventListener : public EventListener { } // Set this to true to print more details for each arrived event for debug. - void set_print_debug_info(bool value) { - print_debug_info_ = value; - } + void set_print_debug_info(bool value) { print_debug_info_ = value; } // Copies events from the internal buffer, starting from `start`, up to but // not including `end`. @@ -183,9 +179,7 @@ class FirestoreIntegrationTest : public testing::Test { FirestoreIntegrationTest& operator=(FirestoreIntegrationTest&&) = delete; protected: - App* app() { - return TestFirestore()->app(); - } + App* app() { return TestFirestore()->app(); } // Returns a Firestore instance for an app with the given name. // If this method is invoked again with the same `name`, then the same pointer @@ -326,13 +320,9 @@ class FirestoreIntegrationTest : public testing::Test { static std::string DescribeFailedFuture(const FutureBase& future); - void DisableNetwork() { - Await(TestFirestore()->DisableNetwork()); - } + void DisableNetwork() { Await(TestFirestore()->DisableNetwork()); } - void EnableNetwork() { - Await(TestFirestore()->EnableNetwork()); - } + void EnableNetwork() { Await(TestFirestore()->EnableNetwork()); } static FirestoreInternal* GetFirestoreInternal(Firestore* firestore) { return firestore->internal_; @@ -346,18 +336,11 @@ class FirestoreIntegrationTest : public testing::Test { public: FirestoreInfo() = default; FirestoreInfo(const std::string& name, UniquePtr&& firestore) - : name_(name), firestore_(Move(firestore)) { - } + : name_(name), firestore_(Move(firestore)) {} - const std::string& name() const { - return name_; - } - Firestore* firestore() const { - return firestore_.get(); - } - void ReleaseFirestore() { - firestore_.release(); - } + const std::string& name() const { return name_; } + Firestore* firestore() const { return firestore_.get(); } + void ReleaseFirestore() { firestore_.release(); } private: std::string name_; diff --git a/firestore/integration_test_internal/src/firestore_test.cc b/firestore/integration_test_internal/src/firestore_test.cc index 1b40b3ce88..fb07fd1942 100644 --- a/firestore/integration_test_internal/src/firestore_test.cc +++ b/firestore/integration_test_internal/src/firestore_test.cc @@ -671,8 +671,7 @@ TEST_F(FirestoreIntegrationTest, class SnapshotTestEventListener : public TestEventListener { public: SnapshotTestEventListener(std::string name, TestData& test_data) - : TestEventListener(std::move(name)), test_data_(test_data) { - } + : TestEventListener(std::move(name)), test_data_(test_data) {} void OnEvent(const DocumentSnapshot& value, Error error_code, @@ -700,12 +699,9 @@ TEST_F(FirestoreIntegrationTest, #else class SyncEventListener : public EventListener { public: - explicit SyncEventListener(TestData& test_data) : test_data_(test_data) { - } + explicit SyncEventListener(TestData& test_data) : test_data_(test_data) {} - void OnEvent(Error) override { - test_data_.AddEvent("snapshots-in-sync"); - } + void OnEvent(Error) override { test_data_.AddEvent("snapshots-in-sync"); } private: TestData& test_data_; diff --git a/firestore/integration_test_internal/src/transaction_test.cc b/firestore/integration_test_internal/src/transaction_test.cc index f507b68e85..3f5033aa89 100644 --- a/firestore/integration_test_internal/src/transaction_test.cc +++ b/firestore/integration_test_internal/src/transaction_test.cc @@ -101,8 +101,7 @@ class TransactionTest : public FirestoreIntegrationTest { class TestTransactionFunction : public TransactionFunction { public: - TestTransactionFunction(DocumentReference doc) : doc_(doc) { - } + TestTransactionFunction(DocumentReference doc) : doc_(doc) {} Error Apply(Transaction& transaction, std::string& error_message) override { Error error = Error::kErrorUnknown; @@ -113,12 +112,8 @@ class TestTransactionFunction : public TransactionFunction { return error; } - std::string key() { - return key_; - } - std::string value() { - return value_; - } + std::string key() { return key_; } + std::string value() { return value_; } private: DocumentReference doc_; @@ -145,12 +140,9 @@ class TransactionStage { TransactionStage( std::string tag, std::function func) - : tag_(std::move(tag)), func_(std::move(func)) { - } + : tag_(std::move(tag)), func_(std::move(func)) {} - const std::string& tag() const { - return tag_; - } + const std::string& tag() const { return tag_; } void operator()(Transaction* transaction, const DocumentReference& doc) const { @@ -221,8 +213,7 @@ const auto get = new TransactionStage( */ class TransactionTester { public: - explicit TransactionTester(Firestore* db) : db_(db) { - } + explicit TransactionTester(Firestore* db) : db_(db) {} template TransactionTester& Run(Args... args) { diff --git a/firestore/integration_test_internal/src/util/event_accumulator.h b/firestore/integration_test_internal/src/util/event_accumulator.h index 3277eb311d..64b444a547 100644 --- a/firestore/integration_test_internal/src/util/event_accumulator.h +++ b/firestore/integration_test_internal/src/util/event_accumulator.h @@ -10,12 +10,9 @@ namespace firestore { template class EventAccumulator { public: - EventAccumulator() : listener_("EventAccumulator") { - } + EventAccumulator() : listener_("EventAccumulator") {} - TestEventListener* listener() { - return &listener_; - } + TestEventListener* listener() { return &listener_; } std::vector Await(int num_events) { int old_num_events = num_events_consumed_; @@ -91,18 +88,14 @@ class EventAccumulator { return event; } - void FailOnNextEvent() { - listener_.FailOnNextEvent(); - } + void FailOnNextEvent() { listener_.FailOnNextEvent(); } private: bool HasPendingWrites(T event) { return event.metadata().has_pending_writes(); } - bool IsFromCache(T event) { - return event.metadata().is_from_cache(); - } + bool IsFromCache(T event) { return event.metadata().is_from_cache(); } TestEventListener listener_; diff --git a/firestore/integration_test_internal/src/util/future_test_util.cc b/firestore/integration_test_internal/src/util/future_test_util.cc index 94653034a4..23b7721843 100644 --- a/firestore/integration_test_internal/src/util/future_test_util.cc +++ b/firestore/integration_test_internal/src/util/future_test_util.cc @@ -9,7 +9,9 @@ namespace firebase { namespace { -void PrintTo(std::ostream* os, FutureStatus future_status, int error, +void PrintTo(std::ostream* os, + FutureStatus future_status, + int error, const char* error_message = nullptr) { *os << "Future{status=" << ToEnumeratorName(future_status) << " error=" << firestore::ToFirestoreErrorCodeName(error); diff --git a/firestore/integration_test_internal/src/validation_test.cc b/firestore/integration_test_internal/src/validation_test.cc index d04c1a7e78..a88209363b 100644 --- a/firestore/integration_test_internal/src/validation_test.cc +++ b/firestore/integration_test_internal/src/validation_test.cc @@ -74,8 +74,10 @@ class ValidationTest : public FirestoreIntegrationTest { * Performs a write using each set and/or update API and makes sure it fails * with the expected reason. */ - void ExpectWriteError(const MapFieldValue& data, const std::string& reason, - bool include_sets, bool include_updates) { + void ExpectWriteError(const MapFieldValue& data, + const std::string& reason, + bool include_sets, + bool include_updates) { DocumentReference document = Document(); if (include_sets) {