Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 2 additions & 5 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,9 @@ task:
- cd packages/pigeon
- pushd mock_handler_tester; flutter pub get; popd
- pushd e2e_tests/test_objc; flutter pub get; popd
- pushd platform_tests/ios_swift_unit_tests; flutter pub get; popd
- pushd platform_tests/windows_unit_tests; flutter pub get; popd
- pushd platform_tests/ios_unit_tests; flutter pub get; popd
- pushd platform_tests/test_plugin; flutter pub get; popd
- pushd platform_tests/alternate_language_test_plugin; flutter pub get; popd
- pushd platform_tests/flutter_null_safe_unit_tests; flutter pub get; popd
- pushd platform_tests/android_kotlin_unit_tests; flutter pub get; popd
- pushd platform_tests/android_unit_tests; flutter pub get; popd
publishable_script: ./script/tool_runner.sh publish-check --allow-pre-release
- name: dart_unit_tests
env:
Expand Down
27 changes: 27 additions & 0 deletions packages/pigeon/platform_tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Native Pigeon Tests

This directory contains native test harnesses for native and end-to-end tests
of Pigeon-generated code. The [test script](../tool/run_tests.dart) generates
native code from [pigeons/](../pigeons/) into the native test scaffolding, and
then drives the tests there.

Comment thread
stuartmorgan-g marked this conversation as resolved.
To run these tests, use [`run_tests.dart`](../tool/run_tests.dart)

## test\_plugin

The new unified test harness for all platforms. Tests in this plugin use the
same structure as tests for the Flutter team-maintained plugins, as described
[in the repository documentation](https://github.com/flutter/flutter/wiki/Plugin-Tests).

## alternate\_language\_test\_plugin

The test harness for alternate languages, on platforms that have multiple
supported plugin languages. It covers:
- Java for Android
- Objective-C for iOS

## flutter\_null\_safe\_unit\_tests

Dart unit tests for null-safe mode. This is a legacy structure from before
NNBD was the only mode Pigeon supported; these should be folded back into
the main tests.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.

version:
revision: c7d11549a51eb37807604bdfd1141a82be8fac4b
channel: main

project_type: plugin

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: c7d11549a51eb37807604bdfd1141a82be8fac4b
base_revision: c7d11549a51eb37807604bdfd1141a82be8fac4b
- platform: android
create_revision: c7d11549a51eb37807604bdfd1141a82be8fac4b
base_revision: c7d11549a51eb37807604bdfd1141a82be8fac4b
- platform: ios
create_revision: c7d11549a51eb37807604bdfd1141a82be8fac4b
base_revision: c7d11549a51eb37807604bdfd1141a82be8fac4b

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# alternate_language_test_plugin

Tests for languages not covered by `test_plugin`.
See [the `platform_tests` README](../README.md) for details.

To run these tests, use [`run_tests.dart`](../tool/run_tests.dart)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
group 'com.example.alternate_language_test_plugin'
version '1.0'

buildscript {
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
}
}

rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 31

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
minSdkVersion 16
}

testOptions {
unitTests.includeAndroidResources = true
unitTests.returnDefaultValues = true
unitTests.all {
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen {false}
showStandardStreams = true
}
}
}

dependencies {
testImplementation 'junit:junit:4.+'
testImplementation "org.mockito:mockito-core:3.+"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'alternate_language_test_plugin'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# TODO(stuartmorgan): Remove this, so that review will show the effects of
# changes on generated files. This will need a way to avoid unnecessary churn,
# such as a flag to suppress version stamp generation.
*.java
!AlternateLanguageTestPlugin.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.alternate_language_test_plugin">
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package com.example.alternate_language_test_plugin;

import androidx.annotation.NonNull;
import io.flutter.embedding.engine.plugins.FlutterPlugin;

/**
* This plugin is currently a no-op since only unit tests have been set up. In the future, this will
* register Pigeon APIs used in integration tests.
*/
public class AlternateLanguageTestPlugin implements FlutterPlugin {
@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {}

@Override
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package com.example.android_unit_tests;
package com.example.alternate_language_test_plugin;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

import com.example.android_unit_tests.AllDatatypes.*;
import com.example.alternate_language_test_plugin.AllDatatypes.*;
import io.flutter.plugin.common.BinaryMessenger;
import java.nio.ByteBuffer;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package com.example.android_unit_tests;
package com.example.alternate_language_test_plugin;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

import com.example.android_unit_tests.AsyncHandlers.*;
import com.example.alternate_language_test_plugin.AsyncHandlers.*;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MessageCodec;
import java.nio.ByteBuffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package com.example.android_unit_tests;
package com.example.alternate_language_test_plugin;

import static org.junit.Assert.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package com.example.android_unit_tests;
package com.example.alternate_language_test_plugin;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

import com.example.android_unit_tests.PigeonList.EchoApi;
import com.example.android_unit_tests.PigeonList.TestMessage;
import com.example.alternate_language_test_plugin.PigeonList.EchoApi;
import com.example.alternate_language_test_plugin.PigeonList.TestMessage;
import io.flutter.plugin.common.BinaryMessenger;
import java.nio.ByteBuffer;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package com.example.android_unit_tests;
package com.example.alternate_language_test_plugin;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

import com.example.android_unit_tests.MultipleArity.MultipleArityFlutterApi;
import com.example.alternate_language_test_plugin.MultipleArity.MultipleArityFlutterApi;
import io.flutter.plugin.common.BinaryMessenger;
import java.nio.ByteBuffer;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package com.example.android_unit_tests;
package com.example.alternate_language_test_plugin;

import static org.junit.Assert.*;

import com.example.android_unit_tests.NonNullFields.NonNullFieldSearchRequest;
import com.example.alternate_language_test_plugin.NonNullFields.NonNullFieldSearchRequest;
import java.lang.IllegalStateException;
import org.junit.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package com.example.android_unit_tests;
package com.example.alternate_language_test_plugin;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package com.example.android_unit_tests;
package com.example.alternate_language_test_plugin;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package com.example.android_unit_tests;
package com.example.alternate_language_test_plugin;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package com.example.android_unit_tests;
package com.example.alternate_language_test_plugin;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

import com.example.android_unit_tests.Primitive.PrimitiveFlutterApi;
import com.example.android_unit_tests.Primitive.PrimitiveHostApi;
import com.example.alternate_language_test_plugin.Primitive.PrimitiveFlutterApi;
import com.example.alternate_language_test_plugin.Primitive.PrimitiveHostApi;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MessageCodec;
import java.nio.ByteBuffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
Expand All @@ -31,9 +32,6 @@
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,21 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 31
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.android_unit_tests"
minSdkVersion 16
targetSdkVersion 30
applicationId "com.example.alternate_language_test_plugin_example"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand All @@ -48,18 +52,8 @@ android {
signingConfig signingConfigs.debug
}
}

testOptions {
unitTests.returnDefaultValues = true
}
}

flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.+'
testImplementation "org.mockito:mockito-core:3.+"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android_unit_tests">
<!-- Flutter needs it to communicate with the running application
package="com.example.alternate_language_test_plugin_example">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
Loading