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

Side by Side Diff: chrome/browser/sync/util/channel_unittest.cc

Issue 2075012: Replace changes_channel with an observer list. (Closed)
Patch Set: Ready for checkin Created 10 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
« no previous file with comments | « chrome/browser/sync/util/channel.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/sync/util/channel.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7
8 struct TestEvent {
9 explicit TestEvent(int foo) : data(foo) {}
10 int data;
11 };
12
13 class TestObserver : public browser_sync::ChannelEventHandler<TestEvent> {
14 public:
15 virtual void HandleChannelEvent(const TestEvent& event) {
16 delete hookup;
17 hookup = 0;
18 }
19
20 browser_sync::ChannelHookup<TestEvent>* hookup;
21 };
22
23 TEST(ChannelTest, RemoveOnNotify) {
24 browser_sync::Channel<TestEvent> channel;
25 TestObserver observer;
26
27 observer.hookup = channel.AddObserver(&observer);
28
29 ASSERT_TRUE(0 != observer.hookup);
30 channel.Notify(TestEvent(1));
31 ASSERT_EQ(0, observer.hookup);
32 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/util/channel.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698