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

Side by Side Diff: base/message_pump_glib_unittest.cc

Issue 552004: Style cleanup in preparation for auto-linting base/. (Closed)
Patch Set: Created 10 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 | « base/message_loop.cc ('k') | base/object_watcher_unittest.cc » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/message_pump_glib.h" 5 #include "base/message_pump_glib.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <math.h> 8 #include <math.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 EXPECT_EQ(12, injector()->processed_events()); 289 EXPECT_EQ(12, injector()->processed_events());
290 } 290 }
291 291
292 namespace { 292 namespace {
293 293
294 // This class is a helper for the concurrent events / posted tasks test below. 294 // This class is a helper for the concurrent events / posted tasks test below.
295 // It will quit the main loop once enough tasks and events have been processed, 295 // It will quit the main loop once enough tasks and events have been processed,
296 // while making sure there is always work to do and events in the queue. 296 // while making sure there is always work to do and events in the queue.
297 class ConcurrentHelper : public base::RefCounted<ConcurrentHelper> { 297 class ConcurrentHelper : public base::RefCounted<ConcurrentHelper> {
298 public: 298 public:
299 ConcurrentHelper(EventInjector* injector) 299 explicit ConcurrentHelper(EventInjector* injector)
300 : injector_(injector), 300 : injector_(injector),
301 event_count_(kStartingEventCount), 301 event_count_(kStartingEventCount),
302 task_count_(kStartingTaskCount) { 302 task_count_(kStartingTaskCount) {
303 } 303 }
304 304
305 void FromTask() { 305 void FromTask() {
306 if (task_count_ > 0) { 306 if (task_count_ > 0) {
307 --task_count_; 307 --task_count_;
308 } 308 }
309 if (task_count_ == 0 && event_count_ == 0) { 309 if (task_count_ == 0 && event_count_ == 0) {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 542
543 TEST_F(MessagePumpGLibTest, TestGtkLoop) { 543 TEST_F(MessagePumpGLibTest, TestGtkLoop) {
544 // Tests that events and posted tasks are correctly exectuted if the message 544 // Tests that events and posted tasks are correctly exectuted if the message
545 // loop is not run by MessageLoop::Run() but by a straight Gtk loop. 545 // loop is not run by MessageLoop::Run() but by a straight Gtk loop.
546 // Note that in this case we don't make strong guarantees about niceness 546 // Note that in this case we don't make strong guarantees about niceness
547 // between events and posted tasks. 547 // between events and posted tasks.
548 loop()->PostTask(FROM_HERE, 548 loop()->PostTask(FROM_HERE,
549 NewRunnableFunction(TestGtkLoopInternal, injector())); 549 NewRunnableFunction(TestGtkLoopInternal, injector()));
550 loop()->Run(); 550 loop()->Run();
551 } 551 }
OLDNEW
« no previous file with comments | « base/message_loop.cc ('k') | base/object_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698