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

Side by Side Diff: sync/engine/sync_session_job_unittest.cc

Issue 12317104: Remove canary member from SyncSessionJob (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sync/engine/sync_session_job.h" 5 #include "sync/engine/sync_session_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "sync/internal_api/public/base/model_type_invalidation_map.h" 10 #include "sync/internal_api/public/base/model_type_invalidation_map.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 const ModelSafeRoutingInfo& routes() { return routes_; } 89 const ModelSafeRoutingInfo& routes() { return routes_; }
90 90
91 // Checks that the two jobs are "clones" as defined by SyncSessionJob, 91 // Checks that the two jobs are "clones" as defined by SyncSessionJob,
92 // minus location and SyncSession checking, for reuse in different 92 // minus location and SyncSession checking, for reuse in different
93 // scenarios. 93 // scenarios.
94 void ExpectClonesBase(SyncSessionJob* job, SyncSessionJob* clone) { 94 void ExpectClonesBase(SyncSessionJob* job, SyncSessionJob* clone) {
95 EXPECT_EQ(job->purpose(), clone->purpose()); 95 EXPECT_EQ(job->purpose(), clone->purpose());
96 EXPECT_EQ(job->scheduled_start(), clone->scheduled_start()); 96 EXPECT_EQ(job->scheduled_start(), clone->scheduled_start());
97 EXPECT_EQ(job->start_step(), clone->start_step()); 97 EXPECT_EQ(job->start_step(), clone->start_step());
98 EXPECT_EQ(job->end_step(), clone->end_step()); 98 EXPECT_EQ(job->end_step(), clone->end_step());
99 EXPECT_FALSE(clone->is_canary());
100 } 99 }
101 100
102 private: 101 private:
103 scoped_ptr<sessions::SyncSessionContext> context_; 102 scoped_ptr<sessions::SyncSessionContext> context_;
104 std::vector<scoped_refptr<ModelSafeWorker> > workers_; 103 std::vector<scoped_refptr<ModelSafeWorker> > workers_;
105 MockDelegate delegate_; 104 MockDelegate delegate_;
106 ModelSafeRoutingInfo routes_; 105 ModelSafeRoutingInfo routes_;
107 bool config_params_callback_invoked_; 106 bool config_params_callback_invoked_;
108 }; 107 };
109 108
(...skipping 14 matching lines...) Expand all
124 123
125 ExpectClonesBase(&job1, clone1.get()); 124 ExpectClonesBase(&job1, clone1.get());
126 ExpectClonesBase(&job1, clone1_loc.get()); 125 ExpectClonesBase(&job1, clone1_loc.get());
127 EXPECT_NE(job1.session(), clone1->session()); 126 EXPECT_NE(job1.session(), clone1->session());
128 EXPECT_EQ(job1.from_location().ToString(), 127 EXPECT_EQ(job1.from_location().ToString(),
129 clone1->from_location().ToString()); 128 clone1->from_location().ToString());
130 EXPECT_NE(job1.session(), clone1_loc->session()); 129 EXPECT_NE(job1.session(), clone1_loc->session());
131 EXPECT_EQ(from_here1.ToString(), clone1_loc->from_location().ToString()); 130 EXPECT_EQ(from_here1.ToString(), clone1_loc->from_location().ToString());
132 131
133 context()->set_routing_info(routes()); 132 context()->set_routing_info(routes());
134 clone1->GrantCanaryPrivilege();
135 sessions::test_util::SimulateSuccess(clone1->mutable_session(), 133 sessions::test_util::SimulateSuccess(clone1->mutable_session(),
136 clone1->start_step(), 134 clone1->start_step(),
137 clone1->end_step()); 135 clone1->end_step());
138 clone1->Finish(false); 136 clone1->Finish(false);
139 const tracked_objects::Location from_here2(FROM_HERE); 137 const tracked_objects::Location from_here2(FROM_HERE);
140 scoped_ptr<SyncSessionJob> clone2 = clone1->Clone(); 138 scoped_ptr<SyncSessionJob> clone2 = clone1->Clone();
141 scoped_ptr<SyncSessionJob> clone2_loc(clone1->CloneFromLocation(from_here2)); 139 scoped_ptr<SyncSessionJob> clone2_loc(clone1->CloneFromLocation(from_here2));
142 140
143 ExpectClonesBase(clone1.get(), clone2.get()); 141 ExpectClonesBase(clone1.get(), clone2.get());
144 ExpectClonesBase(clone1.get(), clone2_loc.get()); 142 ExpectClonesBase(clone1.get(), clone2_loc.get());
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 SyncSessionJob job1(SyncSessionJob::CONFIGURATION, TimeTicks::Now(), 215 SyncSessionJob job1(SyncSessionJob::CONFIGURATION, TimeTicks::Now(),
218 session.Pass(), params, FROM_HERE); 216 session.Pass(), params, FROM_HERE);
219 sessions::test_util::SimulateSuccess(job1.mutable_session(), 217 sessions::test_util::SimulateSuccess(job1.mutable_session(),
220 job1.start_step(), 218 job1.start_step(),
221 job1.end_step()); 219 job1.end_step());
222 job1.Finish(false); 220 job1.Finish(false);
223 EXPECT_TRUE(config_params_callback_invoked()); 221 EXPECT_TRUE(config_params_callback_invoked());
224 } 222 }
225 223
226 } // namespace syncer 224 } // namespace syncer
OLDNEW
« sync/engine/sync_scheduler_impl.cc ('K') | « sync/engine/sync_session_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698