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

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

Issue 10451060: sync: migrate invalidation state from syncable::Directory to InvalidationStorage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: include order Created 8 years, 6 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 24 matching lines...) Expand all
35 options.message_loop_type = MessageLoop::TYPE_IO; 35 options.message_loop_type = MessageLoop::TYPE_IO;
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 browser_sync::MakeWeakHandle( 46 browser_sync::MakeWeakHandle(
46 base::WeakPtr<sync_notifier::InvalidationStateTracker>()), 47 base::WeakPtr<sync_notifier::InvalidationStateTracker>()),
47 "fake_client_info")); 48 "fake_client_info"));
48 invalidation_notifier_->AddObserver(&mock_observer_); 49 invalidation_notifier_->AddObserver(&mock_observer_);
49 } 50 }
50 51
51 virtual void TearDown() { 52 virtual void TearDown() {
52 invalidation_notifier_->RemoveObserver(&mock_observer_); 53 invalidation_notifier_->RemoveObserver(&mock_observer_);
53 invalidation_notifier_.reset(); 54 invalidation_notifier_.reset();
54 request_context_getter_ = NULL; 55 request_context_getter_ = NULL;
(...skipping 11 matching lines...) Expand all
66 67
67 TEST_F(NonBlockingInvalidationNotifierTest, Basic) { 68 TEST_F(NonBlockingInvalidationNotifierTest, Basic) {
68 InSequence dummy; 69 InSequence dummy;
69 70
70 syncable::ModelTypePayloadMap type_payloads; 71 syncable::ModelTypePayloadMap type_payloads;
71 type_payloads[syncable::PREFERENCES] = "payload"; 72 type_payloads[syncable::PREFERENCES] = "payload";
72 type_payloads[syncable::BOOKMARKS] = ""; 73 type_payloads[syncable::BOOKMARKS] = "";
73 type_payloads[syncable::AUTOFILL] = ""; 74 type_payloads[syncable::AUTOFILL] = "";
74 75
75 EXPECT_CALL(mock_observer_, OnNotificationStateChange(true)); 76 EXPECT_CALL(mock_observer_, OnNotificationStateChange(true));
76 EXPECT_CALL(mock_observer_, StoreState("new_fake_state"));
77 EXPECT_CALL(mock_observer_, 77 EXPECT_CALL(mock_observer_,
78 OnIncomingNotification(type_payloads, 78 OnIncomingNotification(type_payloads,
79 REMOTE_NOTIFICATION)); 79 REMOTE_NOTIFICATION));
80 EXPECT_CALL(mock_observer_, OnNotificationStateChange(false)); 80 EXPECT_CALL(mock_observer_, OnNotificationStateChange(false));
81 81
82 invalidation_notifier_->SetState("fake_state"); 82 invalidation_notifier_->SetStateDeprecated("fake_state");
83 invalidation_notifier_->SetUniqueId("fake_id"); 83 invalidation_notifier_->SetUniqueId("fake_id");
84 invalidation_notifier_->UpdateCredentials("foo@bar.com", "fake_token"); 84 invalidation_notifier_->UpdateCredentials("foo@bar.com", "fake_token");
85 85
86 invalidation_notifier_->OnNotificationStateChange(true); 86 invalidation_notifier_->OnNotificationStateChange(true);
87 invalidation_notifier_->StoreState("new_fake_state");
88 invalidation_notifier_->OnIncomingNotification(type_payloads, 87 invalidation_notifier_->OnIncomingNotification(type_payloads,
89 REMOTE_NOTIFICATION); 88 REMOTE_NOTIFICATION);
90 invalidation_notifier_->OnNotificationStateChange(false); 89 invalidation_notifier_->OnNotificationStateChange(false);
91 90
92 ui_loop_.RunAllPending(); 91 ui_loop_.RunAllPending();
93 } 92 }
94 93
95 } // namespace 94 } // namespace
96 95
97 } // namespace sync_notifier 96 } // namespace sync_notifier
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