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

Commit df7c8ed4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

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

parents fa3c4994 94c2a21f
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);
        }
    }
}