1 // Copyright 2014 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.
5 package org.chromium.base;
7 import android.content.Context;
8 import android.test.InstrumentationTestCase;
9 import android.test.suitebuilder.annotation.MediumTest;
11 import org.chromium.base.library_loader.LibraryLoaderHelper;
16 * Test class for the native library hack.
18 public class LibraryLoaderHelperTest extends InstrumentationTestCase {
19 private static final String TAG = "LibraryLoaderHelperTest";
22 public void setUp() throws Exception {
23 Context context = getInstrumentation().getTargetContext();
24 LibraryLoaderHelper.deleteLibrariesSynchronously(
25 context, LibraryLoaderHelper.PACKAGE_MANAGER_WORKAROUND_DIR);
29 public void testLoadNativeLibraries() {
30 getInstrumentation().runOnMainSync(new Runnable() {
33 Context context = getInstrumentation().getTargetContext();
34 File libDir = LibraryLoaderHelper.getLibDir(context,
35 LibraryLoaderHelper.PACKAGE_MANAGER_WORKAROUND_DIR);
36 assertTrue(libDir.exists());
37 assertTrue(libDir.isDirectory());
38 assertEquals(libDir.list().length, 0);
40 assertTrue(LibraryLoaderHelper.loadNativeLibrariesUsingWorkaroundForTesting(
43 assertTrue(libDir.list().length > 0);
49 public void tearDown() throws Exception {
50 Context context = getInstrumentation().getTargetContext();
51 LibraryLoaderHelper.deleteLibrariesSynchronously(
52 context, LibraryLoaderHelper.PACKAGE_MANAGER_WORKAROUND_DIR);