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

Unified Diff: frog/await/samples/dartcombat/setup.dart

Issue 10548047: Remove frog from the repository. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move test and update apidoc.gyp. Created 8 years, 6 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 | « frog/await/samples/dartcombat/player.dart ('k') | frog/await/samples/dartcombat/state.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/await/samples/dartcombat/setup.dart
diff --git a/frog/await/samples/dartcombat/setup.dart b/frog/await/samples/dartcombat/setup.dart
deleted file mode 100644
index 1143b03551ee6c436ce4c17bfc91ab3136a25ef6..0000000000000000000000000000000000000000
--- a/frog/await/samples/dartcombat/setup.dart
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/** Entrypoint to set up the dartcombat sample. */
-void setUpGame() {
- setupUI();
- createPlayers();
-}
-
-/** Sets up the UI creating the board for each player. */
-void setupUI() {
- // Note: we set up the UI programatically to make testing easier.
- var div = new Element.tag("div");
- div.innerHTML = """
- <div class='hbox'>
- <div class='vbox'>
- Player 1 board:
- <div class='own' id='p1own'></div>
- Known of enemy's board:
- <div class='enemy' id='p1enemy'></div>
- </div>
- <div style='width:20%'></div>
- <div class='vbox'>
- Player 2 board:
- <div class='own' id='p2own'></div>
- Known of enemy's board:
- <div class='enemy' id='p2enemy'></div>
- </div>
- </div>
- """;
- document.body.nodes.add(div);
-}
-
-/** Create and connect players. */
-void createPlayers() {
- Player player1 = new Player();
- player1.setup(window, 1);
-
- Player player2 = new Player();
- player2.setup(window, 2);
-
- final port2 = await player2.portToPlayer;
- player1.enemy = new FlakyProxy(port2).sendPort;
- final port1 = await player1.portToPlayer;
- player2.enemy = new FlakyProxy(port1).sendPort;
-}
-
-/**
- * Create and connect players, providing a port for communicating progress to
- * the test.
- */
-void createPlayersForTest(SendPort testPort) {
- Player player1 = new Player();
- Player player2 = new Player();
-
- player1._portForTest = testPort;
- player2._portForTest = testPort;
-
- player1.setup(window, 1);
- player2.setup(window, 2);
-
- player1.enemy = await player2.portToPlayer;
- player2.enemy = await player1.portToPlayer;
-}
-
-/**
- * A proxy between ports that randomly drops messages to simulate isolates
- * across the network.
- */
-class FlakyProxy {
- ReceivePort proxy;
-
- SendPort _target;
-
- SendPort get sendPort() => proxy.toSendPort();
-
- FlakyProxy(this._target) {
- proxy = new ReceivePort();
-
- proxy.receive((message, SendPort reply) {
- window.setTimeout(() {
- if (randomlyFail()) {
- reply.send(const [false, "There was an error"], null);
- } else {
- _target.send(message, reply);
- }
- }, 200);
- });
- }
-
- // TODO(sigmund): introduce UI to control flakiness, then do:
- // => Math.random() > 0.9;
- bool randomlyFail() => false;
-}
« no previous file with comments | « frog/await/samples/dartcombat/player.dart ('k') | frog/await/samples/dartcombat/state.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698