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

Unified Diff: base/message_pump_glib_unittest.cc

Issue 7904034: aura: Explicitly disable GTK (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/message_loop.cc ('k') | base/message_pump_x.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_pump_glib_unittest.cc
diff --git a/base/message_pump_glib_unittest.cc b/base/message_pump_glib_unittest.cc
index 496fda6f78c0bc5dabc0cd214cec20a932dda37a..69fbb951b0cdef4db0784e0bedb44f69ca3b1e06 100644
--- a/base/message_pump_glib_unittest.cc
+++ b/base/message_pump_glib_unittest.cc
@@ -4,7 +4,6 @@
#include "base/message_pump_glib.h"
-#include <gtk/gtk.h>
#include <math.h>
#include <algorithm>
@@ -15,6 +14,10 @@
#include "base/threading/thread.h"
#include "testing/gtest/include/gtest/gtest.h"
+#if defined(TOOLKIT_USES_GTK)
+#include <gtk/gtk.h>
+#endif
+
namespace {
// This class injects dummy "events" into the GLib loop. When "handled" these
@@ -395,6 +398,7 @@ TEST_F(MessagePumpGLibTest, TestDrainingGLib) {
namespace {
+#if defined(TOOLKIT_USES_GTK)
void AddEventsAndDrainGtk(EventInjector* injector) {
// Add a couple of dummy events
injector->AddEvent(0, NULL);
@@ -411,9 +415,11 @@ void AddEventsAndDrainGtk(EventInjector* injector) {
gtk_main_iteration();
}
}
+#endif
} // namespace
+#if defined(TOOLKIT_USES_GTK)
TEST_F(MessagePumpGLibTest, TestDrainingGtk) {
// Tests that draining events using Gtk works.
loop()->PostTask(
@@ -422,6 +428,7 @@ TEST_F(MessagePumpGLibTest, TestDrainingGtk) {
EXPECT_EQ(3, injector()->processed_events());
}
+#endif
namespace {
@@ -436,10 +443,16 @@ class GLibLoopRunner : public base::RefCounted<GLibLoopRunner> {
}
}
- void RunGtk() {
+ void RunLoop() {
+#if defined(TOOLKIT_USES_GTK)
while (!quit_) {
gtk_main_iteration();
}
+#else
+ while (!quit_) {
+ g_main_context_iteration(NULL, TRUE);
+ }
+#endif
}
void Quit() {
@@ -513,7 +526,7 @@ void TestGtkLoopInternal(EventInjector* injector) {
FROM_HERE, NewRunnableMethod(runner.get(), &GLibLoopRunner::Quit), 40);
// Run a nested, straight Gtk message loop.
- runner->RunGtk();
+ runner->RunLoop();
ASSERT_EQ(3, task_count);
EXPECT_EQ(4, injector->processed_events());
« no previous file with comments | « base/message_loop.cc ('k') | base/message_pump_x.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698