Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2fc58256 authored by Ajay Panicker's avatar Ajay Panicker
Browse files

Have unittests run as the bluetooth user and add file system tests

Bug: 33257618
Test: runtest bluetooth
Change-Id: Ib7777626015432edd1dc4d2bbbc9d9820b87c999
parent 6f0e0c32
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.android.bluetooth.tests">
          package="com.android.bluetooth.tests"
          android:sharedUserId="android.uid.bluetooth">

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.ACCESS_BLUETOOTH_SHARE" />
+39 −0
Original line number Diff line number Diff line
package com.android.bluetooth;

import android.test.AndroidTestCase;
import java.io.IOException;
import java.io.File;

// Test Bluetooth's ability to write to the different directories that it
// is supposed to own
public class FileSystemWriteTest extends AndroidTestCase {
    public void testBluetoothDirWrite() {
        try {
            File file = new File("/data/misc/bluetooth/test.file");
            assertTrue("File not created", file.createNewFile());
            file.delete();
        } catch (IOException e) {
            fail("Exception creating file /data/misc/bluetooth/test.file: " + e);
        }
    }

    public void testBluedroidDirWrite() {
        try {
            File file = new File("/data/misc/bluedroid/test.file");
            assertTrue("File not created", file.createNewFile());
            file.delete();
        } catch (IOException e) {
            fail("Exception creating file /data/misc/bluedroid/test.file: " + e);
        }
    }

    public void testBluetoothLogsDirWrite() {
        try {
            File file = new File("/data/misc/bluetooth/logs/test.file");
            assertTrue("File not created", file.createNewFile());
            file.delete();
        } catch (IOException e) {
            fail("Exception creating file /data/misc/bluetooth/logs/test.file: " + e);
        }
    }
}