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

Unified Diff: services/dart/echo_apptest.cc

Issue 971083002: Create an apptesting framework for dart. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: msw comments Created 5 years, 10 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
Index: services/dart/echo_apptest.cc
diff --git a/services/dart/echo_apptest.cc b/services/dart/echo_apptest.cc
deleted file mode 100644
index fa9e224b8b98eeee4bdc021e5f7d3ef95f29448f..0000000000000000000000000000000000000000
--- a/services/dart/echo_apptest.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2014 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.
-
-#include "base/files/file_path.h"
-#include "base/logging.h"
-#include "base/path_service.h"
-#include "mojo/public/cpp/application/application_impl.h"
-#include "mojo/public/cpp/application/application_test_base.h"
-#include "services/dart/test/echo_service.mojom.h"
-
-using mojo::String;
-
-namespace dart {
-namespace {
-
-class DartEchoTest : public mojo::test::ApplicationTestBase {
- public:
- DartEchoTest() : ApplicationTestBase() {}
- ~DartEchoTest() override {}
-
- protected:
- // ApplicationTestBase:
- void SetUp() override {
- ApplicationTestBase::SetUp();
- application_impl()->ConnectToService("mojo:dart_echo", &echo_service_);
- }
-
- mojo::EchoServicePtr echo_service_;
-
- private:
- MOJO_DISALLOW_COPY_AND_ASSIGN(DartEchoTest);
-};
-
-struct EchoStringCallback {
- explicit EchoStringCallback(String *s) : echo_value(s) {}
- void Run(const String& value) const {
- *echo_value = value;
- }
- String *echo_value;
-};
-
-TEST_F(DartEchoTest, EchoString) {
- String foo;
- EchoStringCallback callback(&foo);
- echo_service_->EchoString("foo", callback);
- EXPECT_TRUE(echo_service_.WaitForIncomingMethodCall());
- EXPECT_EQ("foo", foo);
- echo_service_->EchoString("quit", callback);
- EXPECT_TRUE(echo_service_.WaitForIncomingMethodCall());
- EXPECT_EQ("quit", foo);
-}
-
-TEST_F(DartEchoTest, EchoEmptyString) {
- String empty;
- EchoStringCallback callback(&empty);
- echo_service_->EchoString("", callback);
- EXPECT_TRUE(echo_service_.WaitForIncomingMethodCall());
- EXPECT_EQ("", empty);
- echo_service_->EchoString("quit", callback);
- EXPECT_TRUE(echo_service_.WaitForIncomingMethodCall());
- EXPECT_EQ("quit", empty);
-}
-
-TEST_F(DartEchoTest, EchoNullString) {
- String null;
- EchoStringCallback callback(&null);
- echo_service_->EchoString(nullptr, callback);
- EXPECT_TRUE(echo_service_.WaitForIncomingMethodCall());
- EXPECT_TRUE(null.is_null());
- echo_service_->EchoString("quit", callback);
- EXPECT_TRUE(echo_service_.WaitForIncomingMethodCall());
- EXPECT_EQ("quit", null);
-}
-
-} // namespace
-} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698