Skip to content

Commit 40b7d9c

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

File tree

5 files changed

+22
-21
lines changed

5 files changed

+22
-21
lines changed

packages/path_provider/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ To access paths returned by
3030
add below lines under the `<manifest>` section in your `tizen-manifest.xml` file.
3131

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

3638
To access paths returned by
@@ -41,7 +43,9 @@ To access paths returned by
4143
add below lines under the `<manifest>` section in your `tizen-manifest.xml` file,
4244

4345
```xml
44-
<privilege>http://tizen.org/privilege/mediastorage</privilege>
46+
<privileges>
47+
<privilege>http://tizen.org/privilege/mediastorage</privilege>
48+
</privileges>
4549
```
4650

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).
51+
and also acquire the `accessMediaLocation` permission using the [`permission_handler`](https://pub.dev/packages/permission_handler_tizen) plugin (to be available soon).

packages/path_provider/example/integration_test/path_provider_test.dart

Lines changed: 5 additions & 2 deletions
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,10 @@ 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+
if (!await Permission.accessMediaLocation.isGranted) {
81+
await Permission.accessMediaLocation.request();
82+
}
8083
final List<Directory> directories =
8184
await getExternalStorageDirectories(type: type);
8285
for (Directory result in directories) {

packages/path_provider/example/pubspec.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ dev_dependencies:
1313
integration_test: ^0.9.2
1414
integration_test_tizen:
1515
path: ../../integration_test/
16+
permission_handler: ^5.0.1+1
17+
permission_handler_tizen:
18+
path: ../../permission_handler/
1619
flutter_driver:
1720
sdk: flutter
1821
pedantic: ^1.8.0
Lines changed: 2 additions & 16 deletions
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

Lines changed: 5 additions & 0 deletions
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 integration tests -->
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)