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

Unified Diff: mojo/public/tests/system_core_perftest.cc

Issue 134823005: Mojo: re-organize public tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 11 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 | « mojo/public/tests/system_core_cpp_unittest.cc ('k') | mojo/public/tests/system_core_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tests/system_core_perftest.cc
diff --git a/mojo/public/tests/system_core_perftest.cc b/mojo/public/tests/system_core_perftest.cc
deleted file mode 100644
index 4d791c36617426a88d20beb1bef60df6ddb78e6b..0000000000000000000000000000000000000000
--- a/mojo/public/tests/system_core_perftest.cc
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This tests the performance of the C API.
-
-#include "mojo/public/system/core.h"
-
-#include "base/basictypes.h"
-#include "base/bind.h"
-#include "base/logging.h"
-#include "mojo/public/tests/test_support.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-class SystemPerftest : public testing::Test {
- public:
- SystemPerftest() {}
- virtual ~SystemPerftest() {}
-
- void NoOp() {
- }
-
- void MessagePipe_CreateAndClose() {
- MojoResult result;
- result = MojoCreateMessagePipe(&h_0_, &h_1_);
- DCHECK_EQ(result, MOJO_RESULT_OK);
- result = MojoClose(h_0_);
- DCHECK_EQ(result, MOJO_RESULT_OK);
- result = MojoClose(h_1_);
- DCHECK_EQ(result, MOJO_RESULT_OK);
- }
-
- void MessagePipe_WriteAndRead(void* buffer, uint32_t bytes) {
- MojoResult result;
- result = MojoWriteMessage(h_0_,
- buffer, bytes,
- NULL, 0,
- MOJO_WRITE_MESSAGE_FLAG_NONE);
- DCHECK_EQ(result, MOJO_RESULT_OK);
- uint32_t read_bytes = bytes;
- result = MojoReadMessage(h_1_,
- buffer, &read_bytes,
- NULL, NULL,
- MOJO_READ_MESSAGE_FLAG_NONE);
- DCHECK_EQ(result, MOJO_RESULT_OK);
- }
-
- void MessagePipe_EmptyRead() {
- MojoResult result;
- result = MojoReadMessage(h_0_,
- NULL, NULL,
- NULL, NULL,
- MOJO_READ_MESSAGE_FLAG_MAY_DISCARD);
- DCHECK_EQ(result, MOJO_RESULT_SHOULD_WAIT);
- }
-
- protected:
- MojoHandle h_0_;
- MojoHandle h_1_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(SystemPerftest);
-};
-
-// A no-op test so we can compare performance.
-TEST_F(SystemPerftest, NoOp) {
- mojo::test::IterateAndReportPerf(
- "NoOp",
- base::Bind(&SystemPerftest::NoOp,
- base::Unretained(this)));
-}
-
-TEST_F(SystemPerftest, MessagePipe_CreateAndClose) {
- mojo::test::IterateAndReportPerf(
- "MessagePipe_CreateAndClose",
- base::Bind(&SystemPerftest::MessagePipe_CreateAndClose,
- base::Unretained(this)));
-}
-
-TEST_F(SystemPerftest, MessagePipe_WriteAndRead) {
- CHECK_EQ(MojoCreateMessagePipe(&h_0_, &h_1_), MOJO_RESULT_OK);
- char buffer[10000] = { 0 };
- mojo::test::IterateAndReportPerf(
- "MessagePipe_WriteAndRead_10bytes",
- base::Bind(&SystemPerftest::MessagePipe_WriteAndRead,
- base::Unretained(this),
- static_cast<void*>(buffer), static_cast<uint32_t>(10)));
- mojo::test::IterateAndReportPerf(
- "MessagePipe_WriteAndRead_100bytes",
- base::Bind(&SystemPerftest::MessagePipe_WriteAndRead,
- base::Unretained(this),
- static_cast<void*>(buffer), static_cast<uint32_t>(100)));
- mojo::test::IterateAndReportPerf(
- "MessagePipe_WriteAndRead_1000bytes",
- base::Bind(&SystemPerftest::MessagePipe_WriteAndRead,
- base::Unretained(this),
- static_cast<void*>(buffer), static_cast<uint32_t>(1000)));
- mojo::test::IterateAndReportPerf(
- "MessagePipe_WriteAndRead_10000bytes",
- base::Bind(&SystemPerftest::MessagePipe_WriteAndRead,
- base::Unretained(this),
- static_cast<void*>(buffer), static_cast<uint32_t>(10000)));
- CHECK_EQ(MojoClose(h_0_), MOJO_RESULT_OK);
- CHECK_EQ(MojoClose(h_1_), MOJO_RESULT_OK);
-}
-
-TEST_F(SystemPerftest, MessagePipe_EmptyRead) {
- CHECK_EQ(MojoCreateMessagePipe(&h_0_, &h_1_), MOJO_RESULT_OK);
- mojo::test::IterateAndReportPerf(
- "MessagePipe_EmptyRead",
- base::Bind(&SystemPerftest::MessagePipe_EmptyRead,
- base::Unretained(this)));
- CHECK_EQ(MojoClose(h_0_), MOJO_RESULT_OK);
- CHECK_EQ(MojoClose(h_1_), MOJO_RESULT_OK);
-}
-
-} // namespace
« no previous file with comments | « mojo/public/tests/system_core_cpp_unittest.cc ('k') | mojo/public/tests/system_core_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698