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

Unified Diff: mojo/dart/apptest/apptest/apptest.dart

Issue 1132063007: Rationalize Dart mojo and sky package structure (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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/dart/apptest/BUILD.gn ('k') | mojo/dart/apptest/lib/apptest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/dart/apptest/apptest/apptest.dart
diff --git a/mojo/dart/apptest/apptest/apptest.dart b/mojo/dart/apptest/apptest/apptest.dart
deleted file mode 100644
index 3d95b762e29aeccd9067ba0833547cd5e97cf553..0000000000000000000000000000000000000000
--- a/mojo/dart/apptest/apptest/apptest.dart
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2015 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.
-
-library apptest;
-
-import 'dart:async';
-
-import 'package:mojo/public/dart/application.dart';
-import 'package:mojo/public/dart/bindings.dart';
-import 'package:mojo/public/dart/core.dart';
-
-// Import and reexport the unittest package. We are a *.dartzip file designed to
-// be linked into your_apptest.mojo file and are your main entrypoint.
-import 'package:unittest/unittest.dart';
-export 'package:unittest/unittest.dart';
-
-// This class is an application that does nothing but tears down the connections
-// between each test.
-class _ConnectionToShellApplication extends Application {
- final List<Function> _testFunctions;
-
- _ConnectionToShellApplication.fromHandle(
- MojoHandle handle, this._testFunctions)
- : super.fromHandle(handle);
-
- // Only run the test suite passed in once we have received an initialize()
- // call from the shell. We need to first have a valid connection to the shell
- // so that apptests can connect to other applications.
- void initialize(List<String> args, String url) {
- _testFunctions.forEach((f) => f(this, url));
- }
-}
-
-// A configuration which properly shuts down our application at the end.
-class _CleanShutdownConfiguration extends SimpleConfiguration {
- final _ConnectionToShellApplication _application;
-
- _CleanShutdownConfiguration(this._application) : super() {}
-
- Duration timeout = const Duration(seconds: 10);
-
- void onTestResult(TestCase externalTestCase) {
- super.onTestResult(externalTestCase);
- _application.resetConnections();
- }
-
- void onDone(bool success) {
- closeApplication();
- super.onDone(success);
- }
-
- Future closeApplication() async {
- await _application.close();
- assert(MojoHandle.reportLeakedHandles());
- }
-}
-
-// The public interface to apptests.
-//
-// In a dart mojo application, |incoming_handle| is args[0]. |testFunction| is a
-// list of functions that actually contains your testing code, and will pass
-// back an application to each of them.
-runAppTests(var incomingHandle, List<Function> testFunction) {
- var appHandle = new MojoHandle(incomingHandle);
- var application =
- new _ConnectionToShellApplication.fromHandle(appHandle, testFunction);
- unittestConfiguration = new _CleanShutdownConfiguration(application);
-}
« no previous file with comments | « mojo/dart/apptest/BUILD.gn ('k') | mojo/dart/apptest/lib/apptest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698