Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / sync / test / fake_server / fake_server_verifier.h
blob795f210813ffaef1f9ceefa446c3ed807e63b28c
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_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "base/values.h"
12 #include "sync/internal_api/public/base/model_type.h"
13 #include "sync/test/fake_server/sessions_hierarchy.h"
14 #include "testing/gtest/include/gtest/gtest.h"
16 namespace fake_server {
18 class FakeServer;
20 // Provides methods to verify the state of a FakeServer. The main use case of
21 // this class is verifying committed data so that it does not have to be synced
22 // down to another test client for verification. These methods are not present
23 // on FakeServer so that its interface is not polluted.
24 class FakeServerVerifier {
25 public:
26 // Creates a FakeServerVerifier for |fake_server|. This class does not take
27 // ownership of |fake_server|.
28 explicit FakeServerVerifier(FakeServer* fake_server);
29 virtual ~FakeServerVerifier();
31 // Returns a successful result if there are |expected_count| entities with the
32 // given |model_type|. A failure is returned if the count does not match or
33 // verification can't take place.
34 testing::AssertionResult VerifyEntityCountByType(
35 size_t expected_count,
36 syncer::ModelType model_type) const;
38 // Returns a successful result if there are |expected_count| entities with the
39 // given |model_type| and |name|. A failure is returned if the count does not
40 // match or verification can't take place.
41 testing::AssertionResult VerifyEntityCountByTypeAndName(
42 size_t expected_count,
43 syncer::ModelType model_type,
44 const std::string& name) const;
46 // Returns a successful result if |expected_sessions| matches the sessions
47 // hierarchy present on the server. This method only supports one session.
48 testing::AssertionResult VerifySessions(
49 const SessionsHierarchy& expected_sessions);
51 private:
52 FakeServer* const fake_server_;
54 DISALLOW_COPY_AND_ASSIGN(FakeServerVerifier);
57 } // namespace fake_server
59 #endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_VERIFIER_H_