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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/util/channel.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/util/channel_unittest.cc
diff --git a/chrome/browser/sync/util/channel_unittest.cc b/chrome/browser/sync/util/channel_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f2317dcc979b0449f8e39158c0a1f88021e987a4
--- /dev/null
+++ b/chrome/browser/sync/util/channel_unittest.cc
@@ -0,0 +1,32 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/sync/util/channel.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+struct TestEvent {
+ explicit TestEvent(int foo) : data(foo) {}
+ int data;
+};
+
+class TestObserver : public browser_sync::ChannelEventHandler<TestEvent> {
+ public:
+ virtual void HandleChannelEvent(const TestEvent& event) {
+ delete hookup;
+ hookup = 0;
+ }
+
+ browser_sync::ChannelHookup<TestEvent>* hookup;
+};
+
+TEST(ChannelTest, RemoveOnNotify) {
+ browser_sync::Channel<TestEvent> channel;
+ TestObserver observer;
+
+ observer.hookup = channel.AddObserver(&observer);
+
+ ASSERT_TRUE(0 != observer.hookup);
+ channel.Notify(TestEvent(1));
+ ASSERT_EQ(0, observer.hookup);
+}
« 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