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

Unified Diff: dart/compiler/javatests/com/google/dart/compiler/MockLibrarySource.java

Issue 20722006: Removed compiler/ directory from repository (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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: dart/compiler/javatests/com/google/dart/compiler/MockLibrarySource.java
diff --git a/dart/compiler/javatests/com/google/dart/compiler/MockLibrarySource.java b/dart/compiler/javatests/com/google/dart/compiler/MockLibrarySource.java
deleted file mode 100644
index 7c06ffbd4072fa5a4e119fd98d2d7326c3c63e1e..0000000000000000000000000000000000000000
--- a/dart/compiler/javatests/com/google/dart/compiler/MockLibrarySource.java
+++ /dev/null
@@ -1,91 +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.
-
-package com.google.dart.compiler;
-
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Testing implementation of {@link LibrarySource}.
- */
-public class MockLibrarySource extends SourceTest implements LibrarySource {
-
- private final static String TEST_APP_NAME = "Test_app";
-
- private final List<LibrarySource> imports = new ArrayList<LibrarySource>();
- private final List<DartSource> sources = new ArrayList<DartSource>();
-
- public MockLibrarySource() {
- super(TEST_APP_NAME);
- }
-
- @Override
- public Reader getSourceReader() {
- ArrayList<String> libNames = new ArrayList<String>();
- for (LibrarySource lib : imports) {
- libNames.add(lib.getName());
- }
- ArrayList<String> sourceNames = new ArrayList<String>();
- for (DartSource source : sources) {
- sourceNames.add(source.getName());
- }
- // Passing null for the entryPoint, assuming the source already contains a
- // toplevel main() or is a library that doesn't require an entryPoint.
- return new StringReader(DefaultLibrarySource.generateSource(
- getName(), libNames, sourceNames, null));
- }
-
- @Override
- public LibrarySource getImportFor(String relPath) {
- for (LibrarySource lib : imports) {
- if (lib.getName().equals(relPath)) {
- return lib;
- }
- }
- return null;
- }
-
- @Override
- public DartSource getSourceFor(String relPath) {
- if (relPath.equals(TEST_APP_NAME)) {
- return new MockDartSource(this);
- }
- for (DartSource source : sources) {
- if (source.getName().equals(relPath)) {
- return source;
- }
- }
- return null;
- }
-
- public void addSource(DartSource src) {
- sources.add(src);
- }
-
- private static class MockDartSource extends SourceTest implements DartSource {
- final MockLibrarySource libSource;
- public MockDartSource(MockLibrarySource libSource) {
- super(libSource.getName());
- this.libSource = libSource;
- }
-
- @Override
- public Reader getSourceReader() {
- return libSource.getSourceReader();
- }
-
- @Override
- public LibrarySource getLibrary() {
- return libSource;
- }
-
- @Override
- public String getRelativePath() {
- return libSource.getUri().toString();
- }
- }
-}

Powered by Google App Engine
This is Rietveld 408576698