Skip to content

Commit e18f7cb

Browse files
author
Murat Yener
committed
addressed comments
1 parent f79b19c commit e18f7cb

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

benchmarks/src/main/java/com/google/samples/apps/nowinandroid/foryou/ForYouActions.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,17 @@ fun MacrobenchmarkScope.forYouScrollFeedDownUp() {
8888
val feedList = device.findObject(By.res("forYou:feed"))
8989
device.flingElementDownUp(feedList)
9090
}
91+
92+
fun MacrobenchmarkScope.setAppTheme(isDark: Boolean) {
93+
when (isDark) {
94+
true -> device.findObject(By.text("Dark")).click()
95+
false -> device.findObject(By.text("Light")).click()
96+
}
97+
device.waitForIdle()
98+
device.findObject(By.text("OK")).click()
99+
100+
// Wait until the top app bar is visible on screen
101+
device.wait(Until.hasObject(By.res("niaTopAppBar")), 2_000)
102+
val topAppBar = device.findObject(By.res("niaTopAppBar"))
103+
topAppBar.wait(Until.hasObject(By.text("Now in Android")), 2_000)
104+
}

benchmarks/src/main/java/com/google/samples/apps/nowinandroid/interests/InterestsActions.kt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,3 @@ fun MacrobenchmarkScope.interestsToggleBookmarked() {
4848
checkable.click()
4949
device.waitForIdle()
5050
}
51-
52-
fun MacrobenchmarkScope.setAppTheme(isDark: Boolean) {
53-
when (isDark) {
54-
true -> device.findObject(By.text("Dark")).click()
55-
false -> device.findObject(By.text("Light")).click()
56-
}
57-
device.waitForIdle()
58-
device.findObject(By.text("OK")).click()
59-
60-
// Wait until interests are shown on screen
61-
device.wait(Until.hasObject(By.res("niaTopAppBar")), 2_000)
62-
val topAppBar = device.findObject(By.res("niaTopAppBar"))
63-
topAppBar.wait(Until.hasObject(By.text("Now in Android")), 2_000)
64-
}

benchmarks/src/main/java/com/google/samples/apps/nowinandroid/interests/ScrollTopicListPowerMetricsBenchmark.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 The Android Open Source Project
2+
* Copyright 2023 The Android Open Source Project
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@ import com.google.samples.apps.nowinandroid.allowNotifications
3333
import com.google.samples.apps.nowinandroid.foryou.forYouScrollFeedDownUp
3434
import com.google.samples.apps.nowinandroid.foryou.forYouSelectTopics
3535
import com.google.samples.apps.nowinandroid.foryou.forYouWaitForContent
36+
import com.google.samples.apps.nowinandroid.foryou.setAppTheme
3637
import org.junit.Rule
3738
import org.junit.Test
3839
import org.junit.runner.RunWith
@@ -67,7 +68,7 @@ class ScrollTopicListPowerMetricsBenchmark {
6768
pressHome()
6869
startActivityAndWait()
6970
allowNotifications()
70-
// Navigate to interests screen
71+
// Navigate to Settings
7172
device.findObject(By.desc("Settings")).click()
7273
device.waitForIdle()
7374
setAppTheme(isDark)

0 commit comments

Comments
 (0)