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

Side by Side Diff: base/message_pump_glib_unittest.cc

Issue 6300001: Clang: enable -Wbool-conversions and -Wunused-variables on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, undo indent Created 9 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 | « base/message_loop_unittest.cc ('k') | base/pr_time_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) 2010 The Chromium Authors. All rights reserved. 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 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 27 matching lines...) Expand all
38 // If the queue is empty, block. 38 // If the queue is empty, block.
39 if (events_.empty()) 39 if (events_.empty())
40 return -1; 40 return -1;
41 base::TimeDelta delta = events_[0].time - base::Time::NowFromSystemTime(); 41 base::TimeDelta delta = events_[0].time - base::Time::NowFromSystemTime();
42 return std::max(0, static_cast<int>(ceil(delta.InMillisecondsF()))); 42 return std::max(0, static_cast<int>(ceil(delta.InMillisecondsF())));
43 } 43 }
44 44
45 bool HandleCheck() { 45 bool HandleCheck() {
46 if (events_.empty()) 46 if (events_.empty())
47 return false; 47 return false;
48 Event event = events_[0];
49 return events_[0].time <= base::Time::NowFromSystemTime(); 48 return events_[0].time <= base::Time::NowFromSystemTime();
50 } 49 }
51 50
52 void HandleDispatch() { 51 void HandleDispatch() {
53 if (events_.empty()) 52 if (events_.empty())
54 return; 53 return;
55 Event event = events_[0]; 54 Event event = events_[0];
56 events_.erase(events_.begin()); 55 events_.erase(events_.begin());
57 ++processed_events_; 56 ++processed_events_;
58 if (event.task) { 57 if (event.task) {
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 534
536 TEST_F(MessagePumpGLibTest, TestGtkLoop) { 535 TEST_F(MessagePumpGLibTest, TestGtkLoop) {
537 // Tests that events and posted tasks are correctly exectuted if the message 536 // Tests that events and posted tasks are correctly exectuted if the message
538 // loop is not run by MessageLoop::Run() but by a straight Gtk loop. 537 // loop is not run by MessageLoop::Run() but by a straight Gtk loop.
539 // Note that in this case we don't make strong guarantees about niceness 538 // Note that in this case we don't make strong guarantees about niceness
540 // between events and posted tasks. 539 // between events and posted tasks.
541 loop()->PostTask(FROM_HERE, 540 loop()->PostTask(FROM_HERE,
542 NewRunnableFunction(TestGtkLoopInternal, injector())); 541 NewRunnableFunction(TestGtkLoopInternal, injector()));
543 loop()->Run(); 542 loop()->Run();
544 } 543 }
OLDNEW
« no previous file with comments | « base/message_loop_unittest.cc ('k') | base/pr_time_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698