| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SYNC_TEST_FAKE_SERVER_FAKE_SERVER_VERIFIER_H_ | |
| 6 #define SYNC_TEST_FAKE_SERVER_FAKE_SERVER_VERIFIER_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 #include <string> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 #include "base/values.h" | |
| 14 #include "sync/internal_api/public/base/model_type.h" | |
| 15 #include "sync/test/fake_server/sessions_hierarchy.h" | |
| 16 #include "testing/gtest/include/gtest/gtest.h" | |
| 17 | |
| 18 namespace fake_server { | |
| 19 | |
| 20 class FakeServer; | |
| 21 | |
| 22 // Provides methods to verify the state of a FakeServer. The main use case of | |
| 23 // this class is verifying committed data so that it does not have to be synced | |
| 24 // down to another test client for verification. These methods are not present | |
| 25 // on FakeServer so that its interface is not polluted. | |
| 26 class FakeServerVerifier { | |
| 27 public: | |
| 28 // Creates a FakeServerVerifier for |fake_server|. This class does not take | |
| 29 // ownership of |fake_server|. | |
| 30 explicit FakeServerVerifier(FakeServer* fake_server); | |
| 31 virtual ~FakeServerVerifier(); | |
| 32 | |
| 33 // Returns a successful result if there are |expected_count| entities with the | |
| 34 // given |model_type|. A failure is returned if the count does not match or | |
| 35 // verification can't take place. | |
| 36 testing::AssertionResult VerifyEntityCountByType( | |
| 37 size_t expected_count, | |
| 38 syncer::ModelType model_type) const; | |
| 39 | |
| 40 // Returns a successful result if there are |expected_count| entities with the | |
| 41 // given |model_type| and |name|. A failure is returned if the count does not | |
| 42 // match or verification can't take place. | |
| 43 testing::AssertionResult VerifyEntityCountByTypeAndName( | |
| 44 size_t expected_count, | |
| 45 syncer::ModelType model_type, | |
| 46 const std::string& name) const; | |
| 47 | |
| 48 // Returns a successful result if |expected_sessions| matches the sessions | |
| 49 // hierarchy present on the server. This method only supports one session. | |
| 50 testing::AssertionResult VerifySessions( | |
| 51 const SessionsHierarchy& expected_sessions); | |
| 52 | |
| 53 private: | |
| 54 FakeServer* const fake_server_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(FakeServerVerifier); | |
| 57 }; | |
| 58 | |
| 59 } // namespace fake_server | |
| 60 | |
| 61 #endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_VERIFIER_H_ | |
| OLD | NEW |