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

Side by Side Diff: sync/notifier/non_blocking_invalidation_notifier_unittest.cc

Issue 10795018: [Sync] Remove unneeded 'using syncer::' lines and 'syncer::' scopings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fiix indent Created 8 years, 5 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
« no previous file with comments | « sync/notifier/non_blocking_invalidation_notifier.cc ('k') | sync/notifier/p2p_notifier.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/notifier/non_blocking_invalidation_notifier.h" 5 #include "sync/notifier/non_blocking_invalidation_notifier.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 25 matching lines...) Expand all
36 io_thread_.StartWithOptions(options); 36 io_thread_.StartWithOptions(options);
37 request_context_getter_ = 37 request_context_getter_ =
38 new TestURLRequestContextGetter(io_thread_.message_loop_proxy()); 38 new TestURLRequestContextGetter(io_thread_.message_loop_proxy());
39 notifier::NotifierOptions notifier_options; 39 notifier::NotifierOptions notifier_options;
40 notifier_options.request_context_getter = request_context_getter_; 40 notifier_options.request_context_getter = request_context_getter_;
41 invalidation_notifier_.reset( 41 invalidation_notifier_.reset(
42 new NonBlockingInvalidationNotifier( 42 new NonBlockingInvalidationNotifier(
43 notifier_options, 43 notifier_options,
44 InvalidationVersionMap(), 44 InvalidationVersionMap(),
45 std::string(), // initial_invalidation_state 45 std::string(), // initial_invalidation_state
46 syncer::MakeWeakHandle( 46 MakeWeakHandle(base::WeakPtr<InvalidationStateTracker>()),
47 base::WeakPtr<syncer::InvalidationStateTracker>()),
48 "fake_client_info")); 47 "fake_client_info"));
49 invalidation_notifier_->AddObserver(&mock_observer_); 48 invalidation_notifier_->AddObserver(&mock_observer_);
50 } 49 }
51 50
52 virtual void TearDown() { 51 virtual void TearDown() {
53 invalidation_notifier_->RemoveObserver(&mock_observer_); 52 invalidation_notifier_->RemoveObserver(&mock_observer_);
54 invalidation_notifier_.reset(); 53 invalidation_notifier_.reset();
55 request_context_getter_ = NULL; 54 request_context_getter_ = NULL;
56 io_thread_.Stop(); 55 io_thread_.Stop();
57 ui_loop_.RunAllPending(); 56 ui_loop_.RunAllPending();
58 } 57 }
59 58
60 MessageLoop ui_loop_; 59 MessageLoop ui_loop_;
61 base::Thread io_thread_; 60 base::Thread io_thread_;
62 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 61 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
63 scoped_ptr<NonBlockingInvalidationNotifier> invalidation_notifier_; 62 scoped_ptr<NonBlockingInvalidationNotifier> invalidation_notifier_;
64 StrictMock<MockSyncNotifierObserver> mock_observer_; 63 StrictMock<MockSyncNotifierObserver> mock_observer_;
65 notifier::FakeBaseTask fake_base_task_; 64 notifier::FakeBaseTask fake_base_task_;
66 }; 65 };
67 66
68 TEST_F(NonBlockingInvalidationNotifierTest, Basic) { 67 TEST_F(NonBlockingInvalidationNotifierTest, Basic) {
69 InSequence dummy; 68 InSequence dummy;
70 69
71 syncer::ModelTypePayloadMap type_payloads; 70 ModelTypePayloadMap type_payloads;
72 type_payloads[syncer::PREFERENCES] = "payload"; 71 type_payloads[PREFERENCES] = "payload";
73 type_payloads[syncer::BOOKMARKS] = ""; 72 type_payloads[BOOKMARKS] = "";
74 type_payloads[syncer::AUTOFILL] = ""; 73 type_payloads[AUTOFILL] = "";
75 74
76 EXPECT_CALL(mock_observer_, OnNotificationsEnabled()); 75 EXPECT_CALL(mock_observer_, OnNotificationsEnabled());
77 EXPECT_CALL(mock_observer_, 76 EXPECT_CALL(mock_observer_,
78 OnIncomingNotification(type_payloads, 77 OnIncomingNotification(type_payloads,
79 REMOTE_NOTIFICATION)); 78 REMOTE_NOTIFICATION));
80 EXPECT_CALL(mock_observer_, 79 EXPECT_CALL(mock_observer_,
81 OnNotificationsDisabled(TRANSIENT_NOTIFICATION_ERROR)); 80 OnNotificationsDisabled(TRANSIENT_NOTIFICATION_ERROR));
82 EXPECT_CALL(mock_observer_, 81 EXPECT_CALL(mock_observer_,
83 OnNotificationsDisabled(NOTIFICATION_CREDENTIALS_REJECTED)); 82 OnNotificationsDisabled(NOTIFICATION_CREDENTIALS_REJECTED));
84 83
85 invalidation_notifier_->SetStateDeprecated("fake_state"); 84 invalidation_notifier_->SetStateDeprecated("fake_state");
86 invalidation_notifier_->SetUniqueId("fake_id"); 85 invalidation_notifier_->SetUniqueId("fake_id");
87 invalidation_notifier_->UpdateCredentials("foo@bar.com", "fake_token"); 86 invalidation_notifier_->UpdateCredentials("foo@bar.com", "fake_token");
88 87
89 invalidation_notifier_->OnNotificationsEnabled(); 88 invalidation_notifier_->OnNotificationsEnabled();
90 invalidation_notifier_->OnIncomingNotification(type_payloads, 89 invalidation_notifier_->OnIncomingNotification(type_payloads,
91 REMOTE_NOTIFICATION); 90 REMOTE_NOTIFICATION);
92 invalidation_notifier_->OnNotificationsDisabled( 91 invalidation_notifier_->OnNotificationsDisabled(
93 TRANSIENT_NOTIFICATION_ERROR); 92 TRANSIENT_NOTIFICATION_ERROR);
94 invalidation_notifier_->OnNotificationsDisabled( 93 invalidation_notifier_->OnNotificationsDisabled(
95 NOTIFICATION_CREDENTIALS_REJECTED); 94 NOTIFICATION_CREDENTIALS_REJECTED);
96 95
97 ui_loop_.RunAllPending(); 96 ui_loop_.RunAllPending();
98 } 97 }
99 98
100 } // namespace 99 } // namespace
101 100
102 } // namespace syncer 101 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/notifier/non_blocking_invalidation_notifier.cc ('k') | sync/notifier/p2p_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698