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

Add app unit tests to app internal integration test #1046

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2018 Google LLC
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
17 changes: 17 additions & 0 deletions app/integration_test/src/integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@

namespace firebase_testapp_automated {

using app_framework::ProcessEvents;
using firebase_test_framework::FirebaseTest;

class FirebaseAppTest : public FirebaseTest {
public:
FirebaseAppTest();
static void SetUpTestSuite();
static void TearDownTestSuite();
};

FirebaseAppTest::FirebaseAppTest() {
Expand All @@ -56,6 +59,20 @@ FirebaseAppTest::FirebaseAppTest() {
#define APP_CREATE_PARAMS
#endif // defined(__ANDROID__)

void FirebaseAppTest::SetUpTestSuite() {
// Nothing to do here.
}

void FirebaseAppTest::TearDownTestSuite() {
// The App integration test is too fast for FTL, so pause a few seconds
// here.
ProcessEvents(1000);
ProcessEvents(1000);
ProcessEvents(1000);
ProcessEvents(1000);
ProcessEvents(1000);
}

TEST_F(FirebaseAppTest, TestDefaultAppWithDefaultOptions) {
firebase::App* default_app;
default_app = firebase::App::Create(APP_CREATE_PARAMS);
Expand Down
43 changes: 43 additions & 0 deletions app/integration_test_internal/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* Copyright 2020 Google LLC
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.analytics.testapp"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28" />
<application android:label="@string/app_name">
<activity android:name="android.app.NativeActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|screenSize">
<meta-data android:name="android.app.lib_name"
android:value="android_integration_test_main" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.google.intent.action.TEST_LOOP"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="application/javascript"/>
</intent-filter>
</activity>
</application>
</manifest>
Loading