| Index: testing/android/junit/java/src/org/chromium/testing/local/GNManifestFactory.java
|
| diff --git a/testing/android/junit/java/src/org/chromium/testing/local/GNManifestFactory.java b/testing/android/junit/java/src/org/chromium/testing/local/GNManifestFactory.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..09cec0738be785a7a2b99acff2375c88d4751f90
|
| --- /dev/null
|
| +++ b/testing/android/junit/java/src/org/chromium/testing/local/GNManifestFactory.java
|
| @@ -0,0 +1,40 @@
|
| +// Copyright 2017 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.
|
| +
|
| +package org.chromium.testing.local;
|
| +
|
| +import org.robolectric.annotation.Config;
|
| +import org.robolectric.internal.ManifestFactory;
|
| +import org.robolectric.internal.ManifestIdentifier;
|
| +import org.robolectric.manifest.AndroidManifest;
|
| +
|
| +// TODO(mikecase): Add support for specifying the AndroidManifest for
|
| +// Robolectric tests.
|
| +
|
| +/**
|
| + * Class that manages passing Android manifest information to Robolectric.
|
| + */
|
| +public class GNManifestFactory implements ManifestFactory {
|
| + private static final String DEFAULT_PACKAGE_NAME = "org.robolectric.default";
|
| +
|
| + @Override
|
| + public ManifestIdentifier identify(Config config) {
|
| + if (!config.manifest().equals(Config.NONE)) {
|
| + throw new RuntimeException("Specifying custom manifest not currently supported. "
|
| + + "Please use annotation @Config(manifest = Config.NONE) on Robolectric tests "
|
| + + "for the time being.");
|
| + }
|
| + return new ManifestIdentifier(null, null, null, config.packageName(), null);
|
| + }
|
| +
|
| + @Override
|
| + public AndroidManifest create(ManifestIdentifier manifestIdentifier) {
|
| + String packageName = manifestIdentifier.getPackageName();
|
| + if (packageName == null || packageName.equals("")) {
|
| + packageName = DEFAULT_PACKAGE_NAME;
|
| + }
|
| +
|
| + return new AndroidManifest(null, null, null, packageName);
|
| + }
|
| +}
|
|
|