OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.testing.local; |
| 6 |
| 7 import org.robolectric.annotation.Config; |
| 8 import org.robolectric.internal.ManifestFactory; |
| 9 import org.robolectric.internal.ManifestIdentifier; |
| 10 import org.robolectric.manifest.AndroidManifest; |
| 11 |
| 12 // TODO(mikecase): Add support for specifying the AndroidManifest for |
| 13 // Robolectric tests. |
| 14 |
| 15 /** |
| 16 * Class that manages passing Android manifest information to Robolectric. |
| 17 */ |
| 18 public class GNManifestFactory implements ManifestFactory { |
| 19 private static final String DEFAULT_PACKAGE_NAME = "org.robolectric.default"
; |
| 20 |
| 21 @Override |
| 22 public ManifestIdentifier identify(Config config) { |
| 23 if (!config.manifest().equals(Config.NONE)) { |
| 24 throw new RuntimeException("Specifying custom manifest not currently
supported. " |
| 25 + "Please use annotation @Config(manifest = Config.NONE) on
Robolectric tests " |
| 26 + "for the time being."); |
| 27 } |
| 28 return new ManifestIdentifier(null, null, null, config.packageName(), nu
ll); |
| 29 } |
| 30 |
| 31 @Override |
| 32 public AndroidManifest create(ManifestIdentifier manifestIdentifier) { |
| 33 String packageName = manifestIdentifier.getPackageName(); |
| 34 if (packageName == null || packageName.equals("")) { |
| 35 packageName = DEFAULT_PACKAGE_NAME; |
| 36 } |
| 37 |
| 38 return new AndroidManifest(null, null, null, packageName); |
| 39 } |
| 40 } |
OLD | NEW |