| Index: chrome/browser/sync/sessions/test_util.h
|
| diff --git a/chrome/browser/sync/sessions/test_util.h b/chrome/browser/sync/sessions/test_util.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0cd96eb1e7cb4bfd2b9099847b9e40ff2421d83e
|
| --- /dev/null
|
| +++ b/chrome/browser/sync/sessions/test_util.h
|
| @@ -0,0 +1,59 @@
|
| +// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +//
|
| +// Utils to simulate various outcomes of a sync session.
|
| +#ifndef CHROME_BROWSER_SYNC_SESSIONS_TEST_UTIL_H_
|
| +#define CHROME_BROWSER_SYNC_SESSIONS_TEST_UTIL_H_
|
| +#pragma once
|
| +
|
| +#include "chrome/browser/sync/sessions/sync_session.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +#include "testing/gmock/include/gmock/gmock.h"
|
| +
|
| +namespace browser_sync {
|
| +namespace sessions {
|
| +namespace test_util {
|
| +
|
| +void SimulateHasMoreToSync(sessions::SyncSession* session) {
|
| + session->status_controller()->update_conflicts_resolved(true);
|
| + ASSERT_TRUE(session->HasMoreToSync());
|
| +}
|
| +
|
| +void SimulateDownloadUpdatesFailed(sessions::SyncSession* session) {
|
| +
|
| +}
|
| +
|
| +void SimulateCommitFailed(sessions::SyncSession* session) {
|
| +
|
| +}
|
| +
|
| +void SimulateSuccess(sessions::SyncSession* session) {
|
| + ASSERT_FALSE(session->HasMoreToSync());
|
| + ASSERT_EQ(0, session->status_controller()->num_server_changes_remaining());
|
| + ASSERT_EQ(0, session->status_controller()->unsynced_handles().size());
|
| +}
|
| +
|
| +void SimulateThrottledImpl(sessions::SyncSession* session,
|
| + const base::TimeDelta& delta) {
|
| + session->delegate()->OnSilencedUntil(base::TimeTicks::Now() + delta);
|
| +}
|
| +
|
| +ACTION_P(SimulateThrottled, throttle) {
|
| + SimulateThrottledImpl(arg0, throttle);
|
| +}
|
| +
|
| +void SimulatePollIntervalUpdateImpl(sessions::SyncSession* session,
|
| + const base::TimeDelta& new_poll) {
|
| + session->delegate()->OnReceivedLongPollIntervalUpdate(new_poll);
|
| +}
|
| +
|
| +ACTION_P(SimulatePollIntervalUpdate, poll) {
|
| + SimulatePollIntervalUpdateImpl(arg0, poll);
|
| +}
|
| +
|
| +} // namespace test_util
|
| +} // namespace sessions
|
| +} // namespace browser_sync
|
| +
|
| +#endif // CHROME_BROWSER_SYNC_SESSIONS_TEST_UTIL_H_
|
|
|