Define MessagePumpDefault and use it to implement MessageLoop on non-Windows
platforms.  This is actually just a first-step toward the real fix which is to
use MessagePumpDefault on all platforms on non-UI and non-IO threads.

This CL also fixes some GCC compilation errors.  I renamed MessageLoopOwnable
to TaskBase, which seems more appropriate since a MessageLoopOwnable has a
next Task pointer and clearly is only meaningful in the context of Task.  (I
wonder why it is even a separate class, but that is another issue.)  I had to
make the next_task / set_next_task methods public since they are used by an
inner class of MessageLoop.  Perhaps those inner classes should be made into
top-level classes, but that seemed like too much to change at this time.

R=jar,mmentovai

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1045 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc
index fdd36ea..4cc003a2 100644
--- a/base/message_loop_unittest.cc
+++ b/base/message_loop_unittest.cc
@@ -29,15 +29,25 @@
 
 #include "base/logging.h"
 #include "base/message_loop.h"
-#include "base/scoped_handle.h"
-#include "base/thread.h"
+#include "base/platform_thread.h"
 #include "base/ref_counted.h"
+#include "base/thread.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 #if defined(OS_WIN)
 #include "base/message_pump_win.h"
+#include "base/scoped_handle.h"
 #endif
 
+//
+// TODO(darin): This file needs to be re-organized into acceptance tests that
+// apply to a MessageLoop configured to use any MessagePump.  Then, those tests
+// need to be run against all MessagePump types supported by a platform.
+//
+// Finally, platform-specific MessageLoop tests should be grouped together to
+// avoid the chopping this file up with so many #ifdefs.
+//
+
 namespace {
 
 class MessageLoopTest : public testing::Test {
@@ -184,6 +194,8 @@
   int* depth_;
 };
 
+#if defined(OS_WIN)
+
 LONG WINAPI BadExceptionHandler(EXCEPTION_POINTERS *ex_info) {
   ADD_FAILURE() << "bad exception handler";
   ::ExitProcess(ex_info->ExceptionRecord->ExceptionCode);
@@ -200,7 +212,7 @@
       : trash_SEH_handler_(trash_SEH_handler) {
   }
   void Run() {
-    Sleep(1);
+    PlatformThread::Sleep(1);
     if (trash_SEH_handler_)
       ::SetUnhandledExceptionFilter(&BadExceptionHandler);
     // Generate a SEH fault. We do it in asm to make sure we know how to undo
@@ -217,8 +229,8 @@
 
     bad_array_[0] = 66;
 
-#elif
-
+#else
+#error "needs architecture support"
 #endif
 
     MessageLoop::current()->Quit();
@@ -259,6 +271,8 @@
   return EXCEPTION_CONTINUE_EXECUTION;
 }
 
+#endif  // defined(OS_WIN)
+
 }  // namespace
 
 
@@ -406,6 +420,8 @@
   int cookie_;
 };
 
+#if defined(OS_WIN)
+
 // MessageLoop implicitly start a "modal message loop". Modal dialog boxes,
 // common controls (like OpenFile) and StartDoc printing function can cause
 // implicit message loops.
@@ -447,6 +463,8 @@
   }
 };
 
+#endif  // defined(OS_WIN)
+
 class RecursiveTask : public OrderedTasks {
  public:
   RecursiveTask(int depth, TaskList* order, int cookie, bool is_reentrant)
@@ -563,7 +581,7 @@
   MessageLoop::current()->Run();
 
   // FIFO order.
-  ASSERT_EQ(order.size(), 14);
+  ASSERT_EQ(14U, order.size());
   EXPECT_EQ(order[ 0], TaskItem(RECURSIVE, 1, true));
   EXPECT_EQ(order[ 1], TaskItem(RECURSIVE, 1, false));
   EXPECT_EQ(order[ 2], TaskItem(RECURSIVE, 2, true));
@@ -593,7 +611,7 @@
   MessageLoop::current()->Run();
 
   // FIFO order.
-  ASSERT_EQ(order.size(), 14);
+  ASSERT_EQ(14U, order.size());
   EXPECT_EQ(order[ 0], TaskItem(RECURSIVE, 1, true));
   EXPECT_EQ(order[ 1], TaskItem(RECURSIVE, 1, false));
   EXPECT_EQ(order[ 2], TaskItem(RECURSIVE, 2, true));
@@ -728,7 +746,7 @@
   MessageLoop::current()->Run();
 
   // FIFO order.
-  ASSERT_EQ(order.size(), 6);
+  ASSERT_EQ(6U, order.size());
   EXPECT_EQ(order[ 0], TaskItem(ORDERERD, 1, true));
   EXPECT_EQ(order[ 1], TaskItem(ORDERERD, 1, false));
   EXPECT_EQ(order[ 2], TaskItem(ORDERERD, 2, true));
@@ -756,7 +774,7 @@
   MessageLoop::current()->Run();
 
   // FIFO order.
-  ASSERT_EQ(order.size(), 10);
+  ASSERT_EQ(10U, order.size());
   EXPECT_EQ(order[ 0], TaskItem(PUMPS, 1, true));
   EXPECT_EQ(order[ 1], TaskItem(ORDERERD, 3, true));
   EXPECT_EQ(order[ 2], TaskItem(ORDERERD, 3, false));