forked from flutter/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FirebaseStorage getData function (flutter#211)
* added FirebaseStorage getData func * added getData tests * bumped version and updated change log * fix analyzer errors * code style fixes
- Loading branch information
1 parent
83b02cb
commit fd13850
Showing
6 changed files
with
176 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ name: firebase_storage | |
description: Firebase Storage plugin for Flutter. | ||
author: Flutter Team <[email protected]> | ||
homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_storage | ||
version: 0.0.5+1 | ||
version: 0.0.6 | ||
|
||
flutter: | ||
plugin: | ||
|
@@ -14,5 +14,8 @@ dependencies: | |
flutter: | ||
sdk: flutter | ||
|
||
dev_dependencies: | ||
test: ^0.12.24 | ||
|
||
environment: | ||
sdk: ">=1.8.0 <2.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'dart:async'; | ||
import 'dart:typed_data'; | ||
|
||
import 'package:firebase_storage/firebase_storage.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
group('StorageReference', () { | ||
group('getData', () { | ||
const MethodChannel channel = const MethodChannel( | ||
'firebase_storage', | ||
); | ||
|
||
final List<MethodCall> log = <MethodCall>[]; | ||
|
||
StorageReference ref; | ||
|
||
setUp(() { | ||
channel.setMockMethodCallHandler((MethodCall methodCall) { | ||
log.add(methodCall); | ||
return new Future<Uint8List>.value( | ||
new Uint8List.fromList(<int>[1, 2, 3, 4])); | ||
}); | ||
ref = FirebaseStorage.instance | ||
.ref() | ||
.child('avatars') | ||
.child('large') | ||
.child('image.jpg'); | ||
}); | ||
|
||
test('invokes correct method', () async { | ||
await ref.getData(10); | ||
|
||
expect( | ||
log, | ||
equals(<MethodCall>[ | ||
new MethodCall('StorageReference#getData', <String, dynamic>{ | ||
'maxSize': 10, | ||
'path': 'avatars/large/image.jpg', | ||
}), | ||
])); | ||
}); | ||
|
||
test('returns correct result', () async { | ||
expect(await ref.getData(10), | ||
equals(new Uint8List.fromList(<int>[1, 2, 3, 4]))); | ||
}); | ||
}); | ||
}); | ||
} |