Skip to content

Restore fireperf smoke tests as #2158 is fixed. #2282

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

Merged
merged 2 commits into from
Jan 13, 2021
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ public ChildEventListener addChildEventListener(@NonNull ChildEventListener list
}

/**
* Gets the server values for this query. Updates the cache and raises events if successful. If not
* connected, falls back to a locally-cached value.
* Gets the server values for this query. Updates the cache and raises events if successful. If
* not connected, falls back to a locally-cached value.
*/
@NonNull
public Task<DataSnapshot> get() {
Expand Down
3 changes: 1 addition & 2 deletions smoke-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ dependencies {
// TODO(yifany): Restore after messaging in github is up to date
// implementation "com.google.firebase:firebase-messaging"
implementation "com.google.firebase:firebase-ml-vision"
// TODO(b/174858514): Restore after M85 release is live
// implementation "com.google.firebase:firebase-perf"
implementation "com.google.firebase:firebase-perf"
implementation "com.google.firebase:firebase-storage"

// Common utilities (application side)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// 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.

package com.google.firebase.testing;

import static com.google.common.truth.Truth.assertThat;

import androidx.test.runner.AndroidJUnit4;
import com.google.firebase.perf.FirebasePerformance;
import com.google.firebase.perf.metrics.HttpMetric;
import com.google.firebase.perf.metrics.Trace;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
public final class PerformanceMonitoringTest {

@Test
public void trace() {
Trace trace = FirebasePerformance.getInstance().newTrace("test_trace");
trace.start();

trace.putMetric("counter", 1);
trace.incrementMetric("counter", 2);
trace.putAttribute("is_test", "true");

trace.stop();

assertThat(trace.getLongMetric("counter")).isEqualTo(3);
assertThat(trace.getAttribute("is_test")).isEqualTo("true");
}

@Test
public void networkRequest() {
HttpMetric networkRequest =
FirebasePerformance.getInstance()
.newHttpMetric("https://www.google.com", FirebasePerformance.HttpMethod.GET);
networkRequest.start();

networkRequest.setRequestPayloadSize(128);
networkRequest.setResponsePayloadSize(1024);
networkRequest.setHttpResponseCode(200);
networkRequest.setResponseContentType("text/html");
networkRequest.putAttribute("is_test", "true");

networkRequest.stop();

assertThat(networkRequest.getAttribute("is_test")).isEqualTo("true");
}
}