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

Side by Side Diff: chrome/browser/ui/gtk/reload_button_gtk_unittest.cc

Issue 14307023: chrome: Use base::MessageLoop. (Part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_loop.h" 5 #include "base/message_loop.h"
6 #include "chrome/browser/ui/gtk/reload_button_gtk.h" 6 #include "chrome/browser/ui/gtk/reload_button_gtk.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 class ReloadButtonGtkTest : public testing::Test { 9 class ReloadButtonGtkTest : public testing::Test {
10 public: 10 public:
11 ReloadButtonGtkTest(); 11 ReloadButtonGtkTest();
12 12
13 void CheckState(bool enabled, 13 void CheckState(bool enabled,
14 ReloadButtonGtk::Mode intended_mode, 14 ReloadButtonGtk::Mode intended_mode,
15 ReloadButtonGtk::Mode visible_mode, 15 ReloadButtonGtk::Mode visible_mode,
16 bool double_click_timer_running, 16 bool double_click_timer_running,
17 bool stop_to_reload_timer_running); 17 bool stop_to_reload_timer_running);
18 18
19 // These accessors eliminate the need to declare each testcase as a friend. 19 // These accessors eliminate the need to declare each testcase as a friend.
20 void set_mouse_hovered(bool hovered) { 20 void set_mouse_hovered(bool hovered) {
21 reload_.testing_mouse_hovered_ = hovered; 21 reload_.testing_mouse_hovered_ = hovered;
22 } 22 }
23 int reload_count() { return reload_.testing_reload_count_; } 23 int reload_count() { return reload_.testing_reload_count_; }
24 void fake_mouse_leave() { reload_.OnLeaveNotify(reload_.widget(), NULL); } 24 void fake_mouse_leave() { reload_.OnLeaveNotify(reload_.widget(), NULL); }
25 25
26 protected: 26 protected:
27 // We need a message loop for the timers to post events. 27 // We need a message loop for the timers to post events.
28 MessageLoop loop_; 28 base::MessageLoop loop_;
29 29
30 ReloadButtonGtk reload_; 30 ReloadButtonGtk reload_;
31 }; 31 };
32 32
33 ReloadButtonGtkTest::ReloadButtonGtkTest() : reload_(NULL, NULL) { 33 ReloadButtonGtkTest::ReloadButtonGtkTest() : reload_(NULL, NULL) {
34 // Set the timer delays to 0 so that timers will fire as soon as we tell the 34 // Set the timer delays to 0 so that timers will fire as soon as we tell the
35 // message loop to run pending tasks. 35 // message loop to run pending tasks.
36 reload_.double_click_timer_delay_ = base::TimeDelta(); 36 reload_.double_click_timer_delay_ = base::TimeDelta();
37 reload_.stop_to_reload_timer_delay_ = base::TimeDelta(); 37 reload_.stop_to_reload_timer_delay_ = base::TimeDelta();
38 } 38 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 gtk_button_clicked(GTK_BUTTON(reload_.widget())); 136 gtk_button_clicked(GTK_BUTTON(reload_.widget()));
137 reload_.ChangeMode(ReloadButtonGtk::MODE_STOP, false); 137 reload_.ChangeMode(ReloadButtonGtk::MODE_STOP, false);
138 set_mouse_hovered(true); 138 set_mouse_hovered(true);
139 reload_.ChangeMode(ReloadButtonGtk::MODE_RELOAD, false); 139 reload_.ChangeMode(ReloadButtonGtk::MODE_RELOAD, false);
140 140
141 // Now fire the stop-to-reload timer. This should reset the button. 141 // Now fire the stop-to-reload timer. This should reset the button.
142 loop_.RunUntilIdle(); 142 loop_.RunUntilIdle();
143 CheckState(true, ReloadButtonGtk::MODE_RELOAD, ReloadButtonGtk::MODE_RELOAD, 143 CheckState(true, ReloadButtonGtk::MODE_RELOAD, ReloadButtonGtk::MODE_RELOAD,
144 false, false); 144 false, false);
145 } 145 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/reload_button_gtk.cc ('k') | chrome/browser/ui/gtk/simple_message_box_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698