Skip to content

Commit 461dfa4

Browse files
authored
feat(storage,windows): add emulator support (#18030)
1 parent c39e6c4 commit 461dfa4

3 files changed

Lines changed: 6 additions & 11 deletions

File tree

packages/firebase_storage/firebase_storage/windows/firebase_storage_plugin.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@ void FirebaseStoragePlugin::SetMaxDownloadRetryTime(
265265
void FirebaseStoragePlugin::UseStorageEmulator(
266266
const PigeonStorageFirebaseApp& app, const std::string& host, int64_t port,
267267
std::function<void(std::optional<FlutterError> reply)> result) {
268-
// C++ doesn't support emulator on desktop for now. Do nothing.
268+
Storage* cpp_storage = GetCPPStorageFromPigeon(app, "");
269+
cpp_storage->UseEmulator(host, static_cast<int>(port));
270+
result(std::nullopt);
269271
}
270272

271273
void FirebaseStoragePlugin::ReferenceDelete(

tests/integration_test/firebase_storage/firebase_storage_e2e_test.dart

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import 'package:firebase_storage/firebase_storage.dart';
77
import 'package:flutter_test/flutter_test.dart';
88
import 'package:integration_test/integration_test.dart';
99
import 'package:tests/firebase_options.dart';
10-
import 'package:flutter/foundation.dart';
11-
1210
import 'instance_e2e.dart';
1311
import 'list_result_e2e.dart';
1412
import 'reference_e2e.dart';
@@ -24,11 +22,8 @@ void main() {
2422
await Firebase.initializeApp(
2523
options: DefaultFirebaseOptions.currentPlatform,
2624
);
27-
if (defaultTargetPlatform != TargetPlatform.windows) {
28-
// windows doesn't support emulator yet
29-
await FirebaseStorage.instance
30-
.useStorageEmulator(testEmulatorHost, testEmulatorPort);
31-
}
25+
await FirebaseStorage.instance
26+
.useStorageEmulator(testEmulatorHost, testEmulatorPort);
3227

3328
// Add a write only file
3429
await FirebaseStorage.instance

tests/integration_test/firebase_storage/second_bucket.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ void setupSecondBucketTests() {
2424
app: Firebase.app(),
2525
bucket: secondStorageBucket,
2626
);
27-
if (defaultTargetPlatform != TargetPlatform.windows) {
28-
await storage.useStorageEmulator(testEmulatorHost, testEmulatorPort);
29-
}
27+
await storage.useStorageEmulator(testEmulatorHost, testEmulatorPort);
3028
// Cannot putFile as it will fail on web e2e tests
3129
const string = 'some text for creating new files';
3230
final Reference ref = storage.ref('flutter-tests').child('flt-ok.txt');

0 commit comments

Comments
 (0)