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

Side by Side Diff: media/base/bind_to_loop_unittest.cc

Issue 66183002: Replace MessageLoopProxy with SingleThreadTaskRunner for the rest of media/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win and audio tests 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/win/audio_manager_win.cc ('k') | media/media.gyp » ('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 "media/base/bind_to_loop.h" 5 #include "media/base/bind_to_loop.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 // Various tests that check that the bound function is only actually executed 38 // Various tests that check that the bound function is only actually executed
39 // on the message loop, not during the original Run. 39 // on the message loop, not during the original Run.
40 class BindToLoopTest : public ::testing::Test { 40 class BindToLoopTest : public ::testing::Test {
41 public: 41 public:
42 BindToLoopTest() : proxy_(loop_.message_loop_proxy()) {} 42 BindToLoopTest() : proxy_(loop_.message_loop_proxy()) {}
43 43
44 protected: 44 protected:
45 base::MessageLoop loop_; 45 base::MessageLoop loop_;
46 scoped_refptr<base::MessageLoopProxy> proxy_; 46 scoped_refptr<base::SingleThreadTaskRunner> proxy_;
47 }; 47 };
48 48
49 TEST_F(BindToLoopTest, Closure) { 49 TEST_F(BindToLoopTest, Closure) {
50 // Test the closure is run inside the loop, not outside it. 50 // Test the closure is run inside the loop, not outside it.
51 base::WaitableEvent waiter(false, false); 51 base::WaitableEvent waiter(false, false);
52 base::Closure cb = BindToLoop(proxy_, base::Bind( 52 base::Closure cb = BindToLoop(proxy_, base::Bind(
53 &base::WaitableEvent::Signal, base::Unretained(&waiter))); 53 &base::WaitableEvent::Signal, base::Unretained(&waiter)));
54 cb.Run(); 54 cb.Run();
55 EXPECT_FALSE(waiter.IsSignaled()); 55 EXPECT_FALSE(waiter.IsSignaled());
56 loop_.RunUntilIdle(); 56 loop_.RunUntilIdle();
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 &BoundIntegersSet, &a, &b)); 160 &BoundIntegersSet, &a, &b));
161 cb.Run(1, -1); 161 cb.Run(1, -1);
162 EXPECT_EQ(a, 0); 162 EXPECT_EQ(a, 0);
163 EXPECT_EQ(b, 0); 163 EXPECT_EQ(b, 0);
164 loop_.RunUntilIdle(); 164 loop_.RunUntilIdle();
165 EXPECT_EQ(a, 1); 165 EXPECT_EQ(a, 1);
166 EXPECT_EQ(b, -1); 166 EXPECT_EQ(b, -1);
167 } 167 }
168 168
169 } // namespace media 169 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/win/audio_manager_win.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698