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

Unified Diff: components/sync/driver/glue/ui_model_worker_unittest.cc

Issue 2388163002: [Sync] Move //components/sync to the syncer namespace, take 2. (Closed)
Patch Set: Rebase. Created 4 years, 2 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 | « components/sync/driver/glue/ui_model_worker.cc ('k') | components/sync/driver/invalidation_adapter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/driver/glue/ui_model_worker_unittest.cc
diff --git a/components/sync/driver/glue/ui_model_worker_unittest.cc b/components/sync/driver/glue/ui_model_worker_unittest.cc
index 7ad15d960bb061a9738fd703a27644d97e4be73a..74e0f911c9d972e21718eb3f1c256c93e80a9a8e 100644
--- a/components/sync/driver/glue/ui_model_worker_unittest.cc
+++ b/components/sync/driver/glue/ui_model_worker_unittest.cc
@@ -19,8 +19,8 @@
#include "base/threading/thread_task_runner_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
-using browser_sync::UIModelWorker;
-using syncer::SyncerError;
+namespace syncer {
+namespace {
class UIModelWorkerVisitor {
public:
@@ -28,11 +28,11 @@ class UIModelWorkerVisitor {
: quit_loop_when_run_(quit_loop), was_run_(was_run) {}
virtual ~UIModelWorkerVisitor() {}
- virtual syncer::SyncerError DoWork() {
+ virtual SyncerError DoWork() {
was_run_->Signal();
if (quit_loop_when_run_)
base::MessageLoop::current()->QuitWhenIdle();
- return syncer::SYNCER_OK;
+ return SYNCER_OK;
}
private:
@@ -41,22 +41,22 @@ class UIModelWorkerVisitor {
DISALLOW_COPY_AND_ASSIGN(UIModelWorkerVisitor);
};
-// A faux-syncer that only interacts with its model safe worker.
-class Syncer {
+// A fake syncer that only interacts with its model safe worker.
+class FakeSyncer {
public:
- explicit Syncer(UIModelWorker* worker) : worker_(worker) {}
- ~Syncer() {}
+ explicit FakeSyncer(UIModelWorker* worker) : worker_(worker) {}
+ ~FakeSyncer() {}
void SyncShare(UIModelWorkerVisitor* visitor) {
// We wait until the callback is executed. So it is safe to use Unretained.
- syncer::WorkCallback c =
+ WorkCallback c =
base::Bind(&UIModelWorkerVisitor::DoWork, base::Unretained(visitor));
worker_->DoWorkAndWaitUntilDone(c);
}
private:
scoped_refptr<UIModelWorker> worker_;
- DISALLOW_COPY_AND_ASSIGN(Syncer);
+ DISALLOW_COPY_AND_ASSIGN(FakeSyncer);
};
class SyncUIModelWorkerTest : public testing::Test {
@@ -68,10 +68,10 @@ class SyncUIModelWorkerTest : public testing::Test {
void SetUp() override {
faux_syncer_thread_.Start();
bmw_ = new UIModelWorker(base::ThreadTaskRunnerHandle::Get(), nullptr);
- syncer_.reset(new Syncer(bmw_.get()));
+ syncer_.reset(new FakeSyncer(bmw_.get()));
}
- Syncer* syncer() { return syncer_.get(); }
+ FakeSyncer* syncer() { return syncer_.get(); }
UIModelWorker* bmw() { return bmw_.get(); }
base::Thread* core_thread() { return &faux_core_thread_; }
base::Thread* syncer_thread() { return &faux_syncer_thread_; }
@@ -81,7 +81,7 @@ class SyncUIModelWorkerTest : public testing::Test {
base::Thread faux_syncer_thread_;
base::Thread faux_core_thread_;
scoped_refptr<UIModelWorker> bmw_;
- std::unique_ptr<Syncer> syncer_;
+ std::unique_ptr<FakeSyncer> syncer_;
};
TEST_F(SyncUIModelWorkerTest, ScheduledWorkRunsOnUILoop) {
@@ -93,10 +93,13 @@ TEST_F(SyncUIModelWorkerTest, ScheduledWorkRunsOnUILoop) {
syncer_thread()->task_runner()->PostTask(
FROM_HERE,
- base::Bind(&Syncer::SyncShare, base::Unretained(syncer()), v.get()));
+ base::Bind(&FakeSyncer::SyncShare, base::Unretained(syncer()), v.get()));
// We are on the UI thread, so run our loop to process the
// (hopefully) scheduled task from a SyncShare invocation.
base::RunLoop().Run();
syncer_thread()->Stop();
}
+
+} // namespace
+} // namespace syncer
« no previous file with comments | « components/sync/driver/glue/ui_model_worker.cc ('k') | components/sync/driver/invalidation_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698