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.
5 #ifndef SYNC_TEST_FAKE_SERVER_FAKE_SERVER_VERIFIER_H_
6 #define SYNC_TEST_FAKE_SERVER_FAKE_SERVER_VERIFIER_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "base/values.h"
12 #include "sync/internal_api/public/base/model_type.h"
13 #include "testing/gtest/include/gtest/gtest.h"
15 namespace fake_server
{
19 // Provides methods to verify the state of a FakeServer. The main use case of
20 // this class is verifying committed data so that it does not have to be synced
21 // down to another test client for verification. These methods are not present
22 // on FakeServer so that its interface is not polluted.
23 class FakeServerVerifier
{
25 // Creates a FakeServerVerifier for |fake_server|. This class does not take
26 // ownership of |fake_server|.
27 explicit FakeServerVerifier(FakeServer
* fake_server
);
28 virtual ~FakeServerVerifier();
30 // Returns a successful result if there are |expected_count| entities with the
31 // given |model_type|. A failure is returned if the count does not match or
32 // verification can't take place.
33 testing::AssertionResult
VerifyEntityCountByType(
34 size_t expected_count
,
35 syncer::ModelType model_type
) const;
37 // Returns a successful result if there are |expected_count| entities with the
38 // given |model_type| and |name|. A failure is returned if the count does not
39 // match or verification can't take place.
40 testing::AssertionResult
VerifyEntityCountByTypeAndName(
41 size_t expected_count
,
42 syncer::ModelType model_type
,
43 const std::string
& name
) const;
46 FakeServer
* const fake_server_
;
48 DISALLOW_COPY_AND_ASSIGN(FakeServerVerifier
);
51 } // namespace fake_server
53 #endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_VERIFIER_H_