Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(490)

Unified Diff: sync/sessions/sync_session_unittest.cc

Issue 93433006: sync: Introduce ModelTypeRegistry and helpers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory leak in tests Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/sessions/sync_session_context.cc ('k') | sync/sync_core.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/sessions/sync_session_unittest.cc
diff --git a/sync/sessions/sync_session_unittest.cc b/sync/sessions/sync_session_unittest.cc
deleted file mode 100644
index f341f38e3a2a9db9812cd8a3c26bb4e965603637..0000000000000000000000000000000000000000
--- a/sync/sessions/sync_session_unittest.cc
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright 2012 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.
-
-#include "sync/sessions/sync_session.h"
-
-#include "base/compiler_specific.h"
-#include "base/location.h"
-#include "base/memory/ref_counted.h"
-#include "base/message_loop/message_loop.h"
-#include "sync/engine/syncer_types.h"
-#include "sync/internal_api/public/base/model_type.h"
-#include "sync/sessions/status_controller.h"
-#include "sync/syncable/syncable_id.h"
-#include "sync/syncable/syncable_write_transaction.h"
-#include "sync/test/engine/fake_model_worker.h"
-#include "sync/test/engine/test_directory_setter_upper.h"
-#include "sync/util/extensions_activity.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace syncer {
-
-using syncable::WriteTransaction;
-
-namespace sessions {
-namespace {
-
-class SyncSessionTest : public testing::Test,
- public SyncSession::Delegate {
- public:
- SyncSessionTest() : controller_invocations_allowed_(false) {}
-
- SyncSession* MakeSession() {
- return SyncSession::Build(context_.get(), this);
- }
-
- virtual void SetUp() {
- extensions_activity_ = new ExtensionsActivity();
-
- routes_.clear();
- routes_[BOOKMARKS] = GROUP_UI;
- routes_[AUTOFILL] = GROUP_DB;
- scoped_refptr<ModelSafeWorker> passive_worker(
- new FakeModelWorker(GROUP_PASSIVE));
- scoped_refptr<ModelSafeWorker> ui_worker(
- new FakeModelWorker(GROUP_UI));
- scoped_refptr<ModelSafeWorker> db_worker(
- new FakeModelWorker(GROUP_DB));
- workers_.clear();
- workers_.push_back(passive_worker);
- workers_.push_back(ui_worker);
- workers_.push_back(db_worker);
-
- context_.reset(
- new SyncSessionContext(
- NULL,
- NULL,
- workers_,
- extensions_activity_.get(),
- std::vector<SyncEngineEventListener*>(),
- NULL,
- NULL,
- true, // enable keystore encryption
- false, // force enable pre-commit GU avoidance experiment
- "fake_invalidator_client_id"));
- context_->set_routing_info(routes_);
-
- session_.reset(MakeSession());
- }
- virtual void TearDown() {
- session_.reset();
- context_.reset();
- }
-
- virtual void OnThrottled(const base::TimeDelta& throttle_duration) OVERRIDE {
- FailControllerInvocationIfDisabled("OnThrottled");
- }
- virtual void OnTypesThrottled(
- ModelTypeSet types,
- const base::TimeDelta& throttle_duration) OVERRIDE {
- FailControllerInvocationIfDisabled("OnTypesThrottled");
- }
- virtual bool IsCurrentlyThrottled() OVERRIDE {
- FailControllerInvocationIfDisabled("IsSyncingCurrentlySilenced");
- return false;
- }
- virtual void OnReceivedLongPollIntervalUpdate(
- const base::TimeDelta& new_interval) OVERRIDE {
- FailControllerInvocationIfDisabled("OnReceivedLongPollIntervalUpdate");
- }
- virtual void OnReceivedShortPollIntervalUpdate(
- const base::TimeDelta& new_interval) OVERRIDE {
- FailControllerInvocationIfDisabled("OnReceivedShortPollIntervalUpdate");
- }
- virtual void OnReceivedSessionsCommitDelay(
- const base::TimeDelta& new_delay) OVERRIDE {
- FailControllerInvocationIfDisabled("OnReceivedSessionsCommitDelay");
- }
- virtual void OnReceivedClientInvalidationHintBufferSize(
- int size) OVERRIDE {
- FailControllerInvocationIfDisabled(
- "OnReceivedClientInvalidationHintBufferSize");
- }
- virtual void OnSyncProtocolError(
- const sessions::SyncSessionSnapshot& snapshot) OVERRIDE {
- FailControllerInvocationIfDisabled("SyncProtocolError");
- }
-
- void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) const {
- *out = routes_;
- }
-
- StatusController* status() { return session_->mutable_status_controller(); }
- protected:
- void FailControllerInvocationIfDisabled(const std::string& msg) {
- if (!controller_invocations_allowed_)
- FAIL() << msg;
- }
-
- ModelTypeSet ParamsMeaningAllEnabledTypes() {
- ModelTypeSet request_params(BOOKMARKS, AUTOFILL);
- return request_params;
- }
-
- ModelTypeSet ParamsMeaningJustOneEnabledType() {
- return ModelTypeSet(AUTOFILL);
- }
-
- base::MessageLoop message_loop_;
- bool controller_invocations_allowed_;
- scoped_ptr<SyncSession> session_;
- scoped_ptr<SyncSessionContext> context_;
- std::vector<scoped_refptr<ModelSafeWorker> > workers_;
- ModelSafeRoutingInfo routes_;
- scoped_refptr<ExtensionsActivity> extensions_activity_;
-};
-
-} // namespace
-} // namespace sessions
-} // namespace syncer
« no previous file with comments | « sync/sessions/sync_session_context.cc ('k') | sync/sync_core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698