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

Side by Side Diff: components/sync/driver/sync_stopped_reporter_unittest.cc

Issue 2455343003: [Sync] Replaced ASSERT/EXPECT_TRUE/FALSE with expected/actual checks. (Closed)
Patch Set: \Updates for Max and rebase. Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/sync/driver/sync_stopped_reporter.h" 5 #include "components/sync/driver/sync_stopped_reporter.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/test/test_simple_task_runner.h" 9 #include "base/test/test_simple_task_runner.h"
10 #include "base/threading/non_thread_safe.h" 10 #include "base/threading/non_thread_safe.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 EXPECT_EQ(SyncStoppedReporter::RESULT_ERROR, request_result()); 139 EXPECT_EQ(SyncStoppedReporter::RESULT_ERROR, request_result());
140 } 140 }
141 141
142 TEST_F(SyncStoppedReporterTest, DestructionDuringRequestHandler) { 142 TEST_F(SyncStoppedReporterTest, DestructionDuringRequestHandler) {
143 net::TestURLFetcherFactory factory; 143 net::TestURLFetcherFactory factory;
144 factory.set_remove_fetcher_on_delete(true); 144 factory.set_remove_fetcher_on_delete(true);
145 { 145 {
146 SyncStoppedReporter ssr(test_url(), user_agent(), request_context(), 146 SyncStoppedReporter ssr(test_url(), user_agent(), request_context(),
147 callback()); 147 callback());
148 ssr.ReportSyncStopped(kAuthToken, kCacheGuid, kBirthday); 148 ssr.ReportSyncStopped(kAuthToken, kCacheGuid, kBirthday);
149 EXPECT_FALSE(factory.GetFetcherByID(0) == nullptr); 149 EXPECT_NE(nullptr, factory.GetFetcherByID(0));
150 } 150 }
151 EXPECT_TRUE(factory.GetFetcherByID(0) == nullptr); 151 EXPECT_EQ(nullptr, factory.GetFetcherByID(0));
152 } 152 }
153 153
154 TEST_F(SyncStoppedReporterTest, Timeout) { 154 TEST_F(SyncStoppedReporterTest, Timeout) {
155 SyncStoppedReporter ssr(test_url(), user_agent(), request_context(), 155 SyncStoppedReporter ssr(test_url(), user_agent(), request_context(),
156 callback()); 156 callback());
157 157
158 // A task runner that can trigger the timeout immediately. 158 // A task runner that can trigger the timeout immediately.
159 scoped_refptr<base::TestSimpleTaskRunner> task_runner( 159 scoped_refptr<base::TestSimpleTaskRunner> task_runner(
160 new base::TestSimpleTaskRunner()); 160 new base::TestSimpleTaskRunner());
161 ssr.SetTimerTaskRunnerForTest(task_runner); 161 ssr.SetTimerTaskRunnerForTest(task_runner);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 // Begin request. 194 // Begin request.
195 ssr.ReportSyncStopped(kAuthToken, kCacheGuid, kBirthday); 195 ssr.ReportSyncStopped(kAuthToken, kCacheGuid, kBirthday);
196 196
197 // Trigger the timeout. 197 // Trigger the timeout.
198 ASSERT_TRUE(task_runner->HasPendingTask()); 198 ASSERT_TRUE(task_runner->HasPendingTask());
199 task_runner->RunPendingTasks(); 199 task_runner->RunPendingTasks();
200 } 200 }
201 201
202 } // namespace syncer 202 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/driver/data_type_manager_impl_unittest.cc ('k') | components/sync/engine_impl/syncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698