Skip to content

Commit c78f90b

Browse files
committed
Enable test cases for media storage
1 parent 828cc5d commit c78f90b

File tree

5 files changed

+36
-33
lines changed

5 files changed

+36
-33
lines changed

packages/path_provider/README.md

+19-15
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,30 @@ For detailed usage, see https://github.com/flutter/plugins/tree/master/packages/
2222

2323
## Required privileges
2424

25-
To access paths returned by
25+
- To access paths returned by
2626

27-
- `getExternalDataPath`
28-
- `getExternalCachePath`
27+
- `getExternalStoragePaths`
28+
- `getDownloadsPath`
2929

30-
add below lines under the `<manifest>` section in your `tizen-manifest.xml` file.
30+
add below lines under the `<manifest>` section in your `tizen-manifest.xml` file,
3131

32-
```xml
33-
<privilege>http://tizen.org/privilege/externalstorage.appdata</privilege>
34-
```
32+
```xml
33+
<privileges>
34+
<privilege>http://tizen.org/privilege/mediastorage</privilege>
35+
</privileges>
36+
```
3537

36-
To access paths returned by
38+
and also acquire `Permission.accessMediaLocation` using the [`permission_handler`](https://pub.dev/packages/permission_handler_tizen) plugin (to be available soon). The permission is already granted on TV devices by default.
3739

38-
- `getExternalStoragePaths`
39-
- `getDownloadsPath`
40+
- To access paths returned by
4041

41-
add below lines under the `<manifest>` section in your `tizen-manifest.xml` file,
42+
- `getExternalDataPath`
43+
- `getExternalCachePath`
4244

43-
```xml
44-
<privilege>http://tizen.org/privilege/mediastorage</privilege>
45-
```
45+
add below lines under the `<manifest>` section in your `tizen-manifest.xml` file.
4646

47-
and also acquire the **Storage** [permission](https://docs.tizen.org/application/dotnet/tutorials/sec-privileges) using the [`permission_handler`](https://pub.dev/packages/permission_handler_tizen) plugin (to be available soon).
47+
```xml
48+
<privileges>
49+
<privilege>http://tizen.org/privilege/externalstorage.appdata</privilege>
50+
</privileges>
51+
```

packages/path_provider/example/integration_test/path_provider_test.dart

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'dart:io';
88
import 'package:flutter_test/flutter_test.dart';
99
import 'package:path_provider/path_provider.dart';
1010
import 'package:integration_test/integration_test.dart';
11+
import 'package:permission_handler/permission_handler.dart';
1112

1213
void main() {
1314
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
@@ -63,7 +64,6 @@ void main() {
6364
null,
6465
StorageDirectory.music,
6566
StorageDirectory.podcasts,
66-
StorageDirectory.ringtones,
6767
StorageDirectory.alarms,
6868
StorageDirectory.notifications,
6969
StorageDirectory.pictures,
@@ -76,7 +76,11 @@ void main() {
7676
final Future<List<Directory>> result =
7777
getExternalStorageDirectories(type: null);
7878
expect(result, throwsA(isInstanceOf<UnsupportedError>()));
79-
} else if (Platform.isAndroid) {
79+
} else {
80+
// Remove when testing on TV.
81+
if (!await Permission.accessMediaLocation.isGranted) {
82+
await Permission.accessMediaLocation.request();
83+
}
8084
final List<Directory> directories =
8185
await getExternalStorageDirectories(type: type);
8286
for (Directory result in directories) {

packages/path_provider/example/pubspec.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ dev_dependencies:
1313
integration_test: ^0.9.2
1414
integration_test_tizen:
1515
path: ../../integration_test/
16+
permission_handler: ^5.0.1+1
17+
# Remove when testing on TV.
18+
permission_handler_tizen:
19+
path: ../../permission_handler/
1620
flutter_driver:
1721
sdk: flutter
1822
pedantic: ^1.8.0
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
// Copyright 2019 the Chromium project 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.
1+
import 'package:integration_test/integration_test_driver.dart';
42

5-
import 'dart:async';
6-
import 'dart:convert';
7-
import 'dart:io';
8-
import 'package:flutter_driver/flutter_driver.dart';
9-
10-
Future<void> main() async {
11-
final FlutterDriver driver = await FlutterDriver.connect();
12-
final String data =
13-
await driver.requestData(null, timeout: const Duration(minutes: 1));
14-
await driver.close();
15-
final Map<String, dynamic> result = jsonDecode(data);
16-
exit(result['result'] == 'true' ? 0 : 1);
17-
}
3+
Future<void> main() => integrationDriver();

packages/path_provider/example/tizen/tizen-manifest.xml

+5
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@
77
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true"/>
88
</ui-application>
99
<feature name="http://tizen.org/feature/screen.size.all"/>
10+
<privileges>
11+
<!-- privileges required by the integration test -->
12+
<privilege>http://tizen.org/privilege/mediastorage</privilege>
13+
<privilege>http://tizen.org/privilege/externalstorage.appdata</privilege>
14+
</privileges>
1015
</manifest>

0 commit comments

Comments
 (0)