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

Side by Side Diff: tests/MessageBusTest.cpp

Issue 140053002: move SkMessageBus::Get out of header (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: obsolete Created 6 years, 11 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 | « src/gpu/GrResourceCache.cpp ('k') | tests/ResourceCacheTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkMessageBus.h" 8 #include "SkMessageBus.h"
9 #include "Test.h" 9 #include "Test.h"
10 10
11 namespace {
12
13 struct TestMessage { 11 struct TestMessage {
14 int x; 12 int x;
15 float y; 13 float y;
16 }; 14 };
17 15 DECLARE_SKMESSAGEBUS_MESSAGE(TestMessage)
18 } // namespace
19 16
20 DEF_TEST(MessageBus, r) { 17 DEF_TEST(MessageBus, r) {
21 // Register two inboxes to receive all TestMessages. 18 // Register two inboxes to receive all TestMessages.
22 SkMessageBus<TestMessage>::Inbox inbox1, inbox2; 19 SkMessageBus<TestMessage>::Inbox inbox1, inbox2;
23 20
24 // Send two messages. 21 // Send two messages.
25 const TestMessage m1 = { 5, 4.2f }; 22 const TestMessage m1 = { 5, 4.2f };
26 const TestMessage m2 = { 6, 4.3f }; 23 const TestMessage m2 = { 6, 4.3f };
27 SkMessageBus<TestMessage>::Post(m1); 24 SkMessageBus<TestMessage>::Post(m1);
28 SkMessageBus<TestMessage>::Post(m2); 25 SkMessageBus<TestMessage>::Post(m2);
(...skipping 18 matching lines...) Expand all
47 44
48 // Over all this time, inbox2 should have piled up 3 messages. 45 // Over all this time, inbox2 should have piled up 3 messages.
49 inbox2.poll(&messages); 46 inbox2.poll(&messages);
50 REPORTER_ASSERT(r, 3 == messages.count()); 47 REPORTER_ASSERT(r, 3 == messages.count());
51 REPORTER_ASSERT(r, 5 == messages[0].x); 48 REPORTER_ASSERT(r, 5 == messages[0].x);
52 REPORTER_ASSERT(r, 6 == messages[1].x); 49 REPORTER_ASSERT(r, 6 == messages[1].x);
53 REPORTER_ASSERT(r, 1 == messages[2].x); 50 REPORTER_ASSERT(r, 1 == messages[2].x);
54 } 51 }
55 52
56 // Multithreaded tests tbd. 53 // Multithreaded tests tbd.
OLDNEW
« no previous file with comments | « src/gpu/GrResourceCache.cpp ('k') | tests/ResourceCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698