summaryrefslogtreecommitdiffstats
path: root/base/message_pump_glib_unittest.cc
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-21 00:17:19 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-21 00:17:19 +0000
commit258dca4ef35f63a8fa5ba0f0daf7d108cd1a66d9 (patch)
treeae909a1785ad6845f22ec1703fe1cf27d9f41448 /base/message_pump_glib_unittest.cc
parentbf1734063e3091984b53bb3baadcae42a976b0a6 (diff)
downloadchromium_src-258dca4ef35f63a8fa5ba0f0daf7d108cd1a66d9.zip
chromium_src-258dca4ef35f63a8fa5ba0f0daf7d108cd1a66d9.tar.gz
chromium_src-258dca4ef35f63a8fa5ba0f0daf7d108cd1a66d9.tar.bz2
Reland 102005 and 102009: aura: Explicitly disable GTK.
Explicitly disable GTK by setting TOOLKIT_USES_GTK. This is the first in a series of changes required to have chrome on aura build and link without GTK. This CL makes base/ build without GTK. Subsequent CLs will do this for other components. TBR=evan@chromium.org BUG=97131 TEST=none Review URL: http://codereview.chromium.org/7983022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102058 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_pump_glib_unittest.cc')
-rw-r--r--base/message_pump_glib_unittest.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/base/message_pump_glib_unittest.cc b/base/message_pump_glib_unittest.cc
index 496fda6..69fbb95 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());