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

Unified Diff: base/test/test_io_thread.cc

Issue 488003003: Add ChannelProxy benchmark to ipc_perftests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Landing. Created 6 years, 4 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/test/test_io_thread.h ('k') | ipc/ipc_perftests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_io_thread.cc
diff --git a/mojo/system/test_utils.cc b/base/test/test_io_thread.cc
similarity index 52%
copy from mojo/system/test_utils.cc
copy to base/test/test_io_thread.cc
index d4e8d28ea0d786ba7852a90817bd7a95d100aa81..48c1e16531640e8990f5d6b8a3b6490cb0d4aa5b 100644
--- a/mojo/system/test_utils.cc
+++ b/base/test/test_io_thread.cc
@@ -2,17 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "mojo/system/test_utils.h"
+#include "base/test/test_io_thread.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/synchronization/waitable_event.h"
-#include "base/test/test_timeouts.h"
-#include "build/build_config.h"
-
-namespace mojo {
-namespace system {
-namespace test {
namespace {
@@ -24,32 +18,7 @@ void PostTaskAndWaitHelper(base::WaitableEvent* event,
} // namespace
-void PostTaskAndWait(scoped_refptr<base::TaskRunner> task_runner,
- const tracked_objects::Location& from_here,
- const base::Closure& task) {
- base::WaitableEvent event(false, false);
- task_runner->PostTask(from_here,
- base::Bind(&PostTaskAndWaitHelper, &event, task));
- event.Wait();
-}
-
-base::TimeDelta EpsilonTimeout() {
-// Originally, our epsilon timeout was 10 ms, which was mostly fine but flaky on
-// some Windows bots. I don't recall ever seeing flakes on other bots. At 30 ms
-// tests seem reliable on Windows bots, but not at 25 ms. We'd like this timeout
-// to be as small as possible (see the description in the .h file).
-//
-// Currently, |tiny_timeout()| is usually 100 ms (possibly scaled under ASAN,
-// etc.). Based on this, set it to (usually be) 30 ms on Windows and 20 ms
-// elsewhere.
-#if defined(OS_WIN)
- return (TestTimeouts::tiny_timeout() * 3) / 10;
-#else
- return (TestTimeouts::tiny_timeout() * 2) / 10;
-#endif
-}
-
-// TestIOThread ----------------------------------------------------------------
+namespace base {
TestIOThread::TestIOThread(Mode mode)
: io_thread_("test_io_thread"), io_thread_started_(false) {
@@ -87,9 +56,10 @@ void TestIOThread::PostTask(const tracked_objects::Location& from_here,
void TestIOThread::PostTaskAndWait(const tracked_objects::Location& from_here,
const base::Closure& task) {
- ::mojo::system::test::PostTaskAndWait(task_runner(), from_here, task);
+ base::WaitableEvent event(false, false);
+ task_runner()->PostTask(from_here,
+ base::Bind(&PostTaskAndWaitHelper, &event, task));
+ event.Wait();
}
-} // namespace test
-} // namespace system
-} // namespace mojo
+} // namespace base
« no previous file with comments | « base/test/test_io_thread.h ('k') | ipc/ipc_perftests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698