Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More support for wasm #178

Merged
merged 26 commits into from
Feb 10, 2025
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
68e6af1
fix: Using return values (wasm support)
koji-1009 Nov 30, 2024
e7d9517
test: Update getRandomValue test and support wasm error
koji-1009 Dec 1, 2024
2df83f9
feat: Use js_interop instead of html (wasm support)
koji-1009 Dec 1, 2024
3af9272
feat: Add wasm ci test and set timeout-minutes
koji-1009 Dec 1, 2024
e09f999
Merge branch 'master' into fix/support_wasm
koji-1009 Dec 3, 2024
88f1cc4
test: Stop separating jobs by strategy
koji-1009 Dec 3, 2024
9539b5f
fix: getRandomValues
koji-1009 Dec 3, 2024
bac32e9
feat: Unify the behavior of dart2js and dart2wasm
koji-1009 Dec 3, 2024
1a620f4
fix: Simplify
koji-1009 Dec 3, 2024
45ff7e3
feat: Create UnknownError class
koji-1009 Dec 3, 2024
b44ce75
test: fix
koji-1009 Dec 3, 2024
4e8e9de
refactor: Simplify UnknownError
koji-1009 Dec 4, 2024
7856777
refactor: Added processing branching by kIsWasm
koji-1009 Dec 4, 2024
9d36a73
fix: Show only kIsWasm
koji-1009 Dec 5, 2024
2d3497d
remove: Remove kIsWasm
koji-1009 Dec 5, 2024
e4e0e06
Update lib/src/crypto_subtle.dart
koji-1009 Dec 6, 2024
d27cadf
Apply suggestions from code review
koji-1009 Dec 6, 2024
aeeb3cc
fix: Use jsArray and dartArray
koji-1009 Dec 6, 2024
77991b6
fix: minor fix
koji-1009 Dec 6, 2024
b9f7954
test: Remove skip option
koji-1009 Dec 10, 2024
4efab3b
test: Add tests for various lists
koji-1009 Dec 10, 2024
69aa772
fix: Remove kIsWasm
koji-1009 Dec 10, 2024
bd9425a
fix: throw ArgumentError when type is not supported
koji-1009 Dec 10, 2024
d293552
chore: Check wasm coverage
koji-1009 Dec 10, 2024
4b13a9a
chore: Remove unused step
koji-1009 Dec 10, 2024
33aa079
chore: Remove wasm option from windows
koji-1009 Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: Remove skip option
koji-1009 committed Dec 10, 2024
commit b9f7954552f09efce71d42e52bdfcd66df170ea1
33 changes: 15 additions & 18 deletions test/crypto_subtle_test.dart
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ library;
import 'dart:js_interop';
import 'dart:typed_data';

import 'package:flutter/foundation.dart';
import 'package:test/test.dart';
import 'package:webcrypto/src/crypto_subtle.dart' as subtle;
import 'package:webcrypto/src/impl_js/impl_js.dart';
@@ -62,19 +63,6 @@ void main() {
});

group('crypto', () {
test('getRandomValues: success', () {
final data = Uint8List(16 * 1024);
expect(
data.every((e) => e == 0),
isTrue,
);
subtle.window.crypto.getRandomValues(data.toJS);
expect(
data.any((e) => e != 0),
isTrue,
);
}, skip: 'dart2wasm');

test('getRandomValues: success', () {
final data = Uint8List(16 * 1024);
expect(
@@ -83,15 +71,24 @@ void main() {
);
final values = data.toJS;
subtle.window.crypto.getRandomValues(values);
expect(
data.every((e) => e == 0),
isTrue,
);
if (kIsWasm) {
// In dart2wasm, the value is not reflected in Uint8List.
expect(
data.every((e) => e == 0),
isTrue,
);
} else {
// In dart2js, the value is reflected in Uint8List.
expect(
data.every((e) => e == 0),
isFalse,
);
}
expect(
values.toDart.any((e) => e != 0),
isTrue,
);
}, skip: 'dart2js');
});

test('getRandomValues: too long', () {
try {