Commit Graph

666 Commits

Author SHA1 Message Date
SongFerng Wang
b61853f468 Merge "[TeseCase] unify the getResourcesString" 2020-11-15 15:05:39 +00:00
Zoey Chen
7233f63139 Merge "[Provider Model] A mock of WifiCallingQueryImsState for unit test." 2020-11-13 11:49:30 +00:00
Zoey Chen
3abe48ef38 [Provider Model] Add new API to detect
1. current connection is mobile data
 - remove the SubscriptionsPreferenceController#activeNetworkIsCellular() and move into MobileNetworkUtils
2. isProviderModel API
 - Add it in Util for Provider Model
3. isWiFiCallingEnabled
 - remove WifiCallingPreferenceController#isWifiCallingEnabled() and move into MobileNetworkUtils
4. Add nes test case for MobileNetworkUtils

Bug: 171873895
Test: atest -c MobileNetworkUtilsTest
Change-Id: I4bfdf0537fe07d064d6c0ba4a2c44b4a4f158d91
2020-11-13 18:01:10 +08:00
Zoey Chen
80328dc307 [Provider Model] A mock of WifiCallingQueryImsState for unit test.
Copied it from MockWifiCallingQueryImsState which is existed in robotests

Diff: https://diff.googleplex.com/#key=DgvbruCHVQpt

Bug: 172053880
Test: manual
Change-Id: I8255db70fe7916e6ac18b56a646a6761bbda106b
2020-11-13 18:01:01 +08:00
SongFerngWang
ea6b1e2312 [TeseCase] unify the getResourcesString
Bug: 173099559
Test: atest PreferredNetworkModePreferenceControllerTest  (PASS)
atest OpenNetworkSelectPagePreferenceControllerTest (PASS)
atest MobilePlanPreferenceControllerTest            (PASS)
atest MobileDataPreferenceControllerTest            (PASS)
atest Enhanced4gLteSliceHelperTest                  (PASS)
atest AutoSelectPreferenceControllerTest            (PASS)

Change-Id: I9a2e3d69cbd933a1282d51b7d8869e6a1ec4cb14
2020-11-13 15:53:55 +08:00
SongFerng Wang
8096d70c58 Merge "[Testcase] To migration DisabledSubscriptionControllerTest" 2020-11-13 02:37:18 +00:00
SongFerng Wang
9489e8128d Merge "[Testing] To migration DefaultSubscriptionControllerTest" 2020-11-12 13:30:16 +00:00
SongFerngWang
aa941c91b7 [Testing] To migration DefaultSubscriptionControllerTest
1. Use AndroidJunit4 instead of RobolectricTestRunner
2. Use ApplicationProvider instead of RuntimeEnvironment to get context
3. Change Copy Right
4. Create new class and add a function which loads the Settings Resource.
5. remove getOnPreferenceChangeListener. Becasue the error:
java.lang.NoSuchMethodError: No virtual method getOnPreferenceChangeListener()

Bug: 173004787
Test: atest -c DefaultSubscriptionControllerTest
Change-Id: Iac9834f2a47bd8b50234646197a31058ffacaa4b
2020-11-12 16:02:17 +08:00
SongFerngWang
216b346438 [Testcase] To migration DisabledSubscriptionControllerTest
1. Use AndroidJunit4 instead of RobolectricTestRunner
2. Use ApplicationProvider instead of RuntimeEnvironment
   to get context
3. Change Copy Right
4. remove the mock of PreferenceScreen

Bug: 173003522
Test: atest DisabledSubscriptionControllerTest.java
Change-Id: Ia99a4cf4618fcb32162485e7da5e48e3b313ce67
2020-11-12 11:10:20 +08:00
Sarah Chin
92dfa7b2ef Fix CDMA roaming and subscription mode tests
ag/12960261 fixed the robotests but not the unit tests

Test: atest
Fix: 172900794
Change-Id: I871c93f46da3df4b544f2267a15c930cb679901e
2020-11-10 10:59:59 -08:00
TreeHugger Robot
855fc1ef61 Merge "[Testing] To migration NetworkScorerPickerPreferenceControllerTest" 2020-11-04 03:37:45 +00:00
SongFerngWang
22e18a86cc [Testing] To migration NetworkScorerPickerPreferenceControllerTest
1. Use AndroidJunit4 instead of RobolectricTestRunner
2. Use ApplicationProvider instead of RuntimeEnvironment to get context
3. Change Copy Right
4. Add a function which loads the Settings Resource.

Diff: https://diff.googleplex.com/#key=81Ufa1AWkLAi
Bug: 172047348
Test: atest -c NetworkScorerPickerPreferenceControllerTest
Change-Id: I9c1a4f957b92ab572eadbd8a0804bdc83608230b
2020-10-30 13:34:22 +00:00
Jeremy Goldman
a14d7504bb Merge "Fix flaky JUnit test" 2020-10-28 08:34:51 +00:00
Jeremy Goldman
125301d590 Fix flaky JUnit test
This test sometimes fails in PostSubmits because the background
thread which calls the verified class does not have time to execute
before the class is verified.

This creates a helper function to monitor background thread completion.

Test: atest -c AutoSelectPreferenceControllerTest
Change-Id: I6c320abd70fcb5fe823ec122fb0dac67174ecb4a
2020-10-28 05:15:52 +00:00
Jeremy Goldman
1d068385c6 Mock SystemProperties in CDMA JUnit test
Bug: 170608563
Test: atest -c CdmaSubscriptionPreferenceControllerTest
Change-Id: Ibeca5e508d8277a9b84e26829e085c43ce7c26cc
2020-10-27 09:50:42 +00:00
Jeremy Goldman
29c4b84312 Merge "Update JUnit test readme to include atest command." 2020-10-21 04:08:21 +00:00
Jeremy Goldman
ce46d9be6b Update JUnit test readme to include atest command.
Test: N/A
Change-Id: I4c4521ad8077ce120e415afe2907cc26f63e3206
2020-10-21 02:21:54 +00:00
Jeremy Goldman
f9befbb347 Move JUnit tests not from telephony settings into legacy directory.
In order to enable the junit tests as a blocking presubmit, we want
to ensure that all tests within this directory are being actively
maintained. A number of these tests were migrated to robolectric
sometime in 2017-2018, and because they are no longer maintained this CL
moves them into a separate folder, so that they will not be included in
the presubmit.

Please verify that this is the appropriate action to take for these
tests. In the future, the settings team may decide to delete this legacy
directory entirely.

Note that AutoSelectPreferenceControllerTest.setChecked_isChecked_showProgressDialog
is currently failing, but we can fix it in a separate CL.

Test: make SettingsUnitTests && adb install -r out/target/product/shamu/testcases/SettingsUnitTests/arm64/SettingsUnitTests.apk
Change-Id: Iafc15b9ac69b5ca2fec76d3c0c7e247ea0017d49
2020-10-20 10:21:41 +00:00
Jeremy Goldman
6e6d785c06 JUnit readme displays updated apk file location
Test: N/A
Change-Id: I265319c726b5b5ca3e8273be0be61e1b9063e7d6
2020-10-19 10:16:38 +00:00
Jeff DeCew
03ebcc2474 Merge "Update NotificationChannelSettings Preferences in place to prevent re-layout." into rvc-qpr-dev am: e9523b7636
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/12792910

Change-Id: I55f6310b344baebfe6a4425d3644d22d8e479638
2020-10-14 14:41:46 +00:00
Jeff DeCew
5bfe1d3f9c Update NotificationChannelSettings Preferences in place to prevent re-layout.
(cherry picked from commit b409b64045)

Fixes: 110093185
Test: ChannelListPreferenceControllerTest
Change-Id: If6acf305c44085e502a3304ea57e409ce049b40f
Merged-In: If6acf305c44085e502a3304ea57e409ce049b40f
2020-10-12 20:06:48 -04:00
Hall Liu
9d39cc3d63 Merge "Replace TelephonyManager methods for mobile data" 2020-10-09 17:03:16 +00:00
Hall Liu
d67a1c3d8e Replace TelephonyManager methods for mobile data
TelephonyManager had a minor refactor of some of the methods revolving
around mobile data. Change code in Settings to use the new ones instead.

Bug: 169367013
Test: existing unit tests, manual
Change-Id: I7ebae37373d53fb2c59b6b546232dbddf77398d4
2020-10-08 19:37:57 -07:00
Arc Wang
63e015962c [Settings] Remove failure JUnit test cases
This change removes all the files which have any failure JUnit test case.

Bug: 168429329
Test: atest --test-mapping tests/unit:postsubmit
Change-Id: I1665565760f9dfc185bf9b8dd871ee106eba5dd5
2020-10-07 21:26:09 +08:00
Alexander Dorokhine
6decca7890 Migrate away from deprecated Truth APIs.
This is a transitional step towards truth 1.0.1, where these APIs have
been completely removed.

Bug: 168765701
Test: m checkbuild
Merged-In: I76f9c37cb699ce6ab8715ffe35d11668ccbceea1
Change-Id: I76f9c37cb699ce6ab8715ffe35d11668ccbceea1
(cherry picked from commit 46e85a2fad)
2020-10-06 00:25:04 -07:00
Alexander Dorokhine
7aadf2da70 Merge "Migrate away from deprecated Truth APIs." 2020-10-06 07:06:00 +00:00
Tom Hsu
272c21911d Merge "[Settings] Refractor ApnSettings code to independent package folder." 2020-10-06 03:30:10 +00:00
tom hsu
2fd7c9ffd1 [Settings] Refractor ApnSettings code to independent package folder.
Bug: 169750507
Test: make RunSettingsRoboTests
Change-Id: I8b2709ba8d16c625863d8a17abc3d0ab5d019bb8
2020-09-30 15:56:01 +00:00
Betty Chang
e8fa746299 Merge "[Testing] Use AndroidJUnit4 instead in CellDataPreferenceTest" 2020-09-30 06:12:31 +00:00
Treehugger Robot
93cec35cea Merge "[Testing] Use AndroidJUnit4 instead in TelephonyBasePreferenceControllerTest" 2020-09-29 04:33:23 +00:00
Treehugger Robot
27806fde5e Merge "[Testing] use AndroidJUnit4 in new MobileDataPreferenceControllerTest" 2020-09-29 04:30:56 +00:00
Treehugger Robot
1cd8904fc5 Merge "[Testing] use AndroidJUnit4 in new EuiccPreferenceControllerTest" 2020-09-29 04:29:55 +00:00
Treehugger Robot
3eeb8b44c2 Merge "[Testing] use AndroidJUnit4 in new MultiNetworkHeaderControllerTest" 2020-09-29 04:28:34 +00:00
Treehugger Robot
71c667322c Merge "[Testing] Use AndroidJUnit4 instead in TelephonyTogglePreferenceControllerTest" 2020-09-29 04:27:45 +00:00
Betty Chang
40bc88e8ab Merge "[Testing] Use AndroidJUnit4 instead in telephony/cdma/ test files" 2020-09-29 01:56:14 +00:00
Alexander Dorokhine
46e85a2fad Migrate away from deprecated Truth APIs.
This is a transitional step towards truth 1.0.1, where these APIs have
been completely removed.

Bug: 168765701
Test: m checkbuild
Change-Id: I76f9c37cb699ce6ab8715ffe35d11668ccbceea1
2020-09-24 23:09:41 +00:00
Jeremy Goldman
6620c84d89 create junit MobileNetworkPreferenceControllerTest.
1. androidx lifecycle used rather than settingslib wrapper. This allows
us to handle lifecycle events from junit tests as well.
2. Use Mocks or get/set functions rather than robolectric shadows.

MobileNetworkPreferenceControllerTest Diff:
    https://diff.googleplex.com/#key=5P0b2G4iYmcz
Test: atest -c MobileNetworkPreferenceControllerTest
Change-Id: If49fe64e5db89a0cdcac7d26329b8c18626a00de
2020-09-23 17:26:14 +00:00
changbetty
c707b90d0a [Testing] Use AndroidJUnit4 instead in telephony/cdma/ test files
1. Use AndroidJunit4 instead of RobolectricTestRunner
2. Use ApplicationProvider instead of RuntimeEnvironment to get context
3. Change Copy Right
4. To get the original value and add @After to restore the data

Bug:
Test: atest -c CdmaListPreferenceTest
      atest -c CdmaSubscriptionPreferenceControllerTest
      atest -c CdmaSystemSelectPreferenceControllerTest
Change-Id: I110727b643a6755ee888708bd1fb2a39cf524a2d
2020-09-23 17:46:30 +08:00
changbetty
9e78b620d3 [Testing] Use AndroidJUnit4 instead in CellDataPreferenceTest
1. Use AndroidJunit4 instead of RobolectricTestRunner
2. Use ApplicationProvider instead of RuntimeEnvironment to get context
3. Change Copy Right
4. Remove the PreferenceViewHolder that not used in test
5. Remove the ProxySubscriptionManager that can get the real object by
context

Bug: 168767478
Test: atest -c CellDataPreferenceTest
Change-Id: I1fa5747c8c6d224d6b13f1a693ff88e57fd150d3
2020-09-23 16:30:59 +08:00
Jeremy Goldman
37cfec7ac2 Merge "[Testing] AndroidJunit Enhanced4gLteSliceHelperTest" 2020-09-21 03:46:18 +00:00
Jeremy
1885f027d8 [Testing] AndroidJunit Enhanced4gLteSliceHelperTest
Test: atest -c Enhanced4gLteSliceHelperTest
Change-Id: I548ffe60f00cea76d0c4af33ca4ec6f38cbf6247
2020-09-18 15:30:41 -04:00
Jeremy Goldman
d620baa3d7 Merge "[Testing] AndroidJUnit4 NetworkSelectSettingsTest" 2020-09-17 18:58:36 +00:00
Jeremy Goldman
7cb2738fdb [Testing] AndroidJUnit4 NetworkSelectSettingsTest
Test: atest -c NetworkSelectSettingsTest
Change-Id: I1d842cd522df87d1cc762b50ae43e9efc723b154
2020-09-17 16:08:33 +00:00
Jeremy Goldman
953ed3dcd2 Merge "[Testing] AndroidJUnit4 RoamingPreferenceControllerTest" 2020-09-16 00:48:31 +00:00
Jeremy Goldman
b1f8405a83 [Testing] AndroidJUnit4 RoamingPreferenceControllerTest
Test: atest -c RoamingPreferenceControllerTest
Change-Id: I155b1c36381b65d23ca1745e72a6f8388f6909e3
2020-09-15 19:53:54 +00:00
Betty Chang
195aa70291 Merge "[Testing] Use AndroidJUnit4 instead in DataUsageInfoControllerTest" 2020-09-15 06:17:53 +00:00
changbetty
8de635ea7b [Testing] Remove Robolectric import and use AndroidJUnit4 instead in MobileDataEnabledListenerTest
1. Use AndroidJunit4 instead of RobolectricTestRunner
2. Use ApplicationProvider instead of RuntimeEnvironment to get context

Bug: 162048313
Test: atest -c MobileDataEnabledListenerTest
Merged-In: I81b3d6ac075666a45649c8d811832a40bdb1b41b
Change-Id: I34687eb69ef62cd3b6ea6519cee608a7b95f242b
2020-09-15 12:24:10 +08:00
changbetty
5c46c0f881 [Testing] Use AndroidJUnit4 instead in TelephonyTogglePreferenceControllerTest
1. Use AndroidJunit4 instead of RobolectricTestRunner
2. Use ApplicationProvider instead of RuntimeEnvironment to get context
3. Change the Copy Right

Bug: 164986958
Test: atest -c TelephonyTogglePreferenceControllerTest
Merged-In: I3d6c39f45cb1efb1742148f20f03372214eb0cbe
Change-Id: Ie7343f8c6dd45add2832679d95372e750ce350ce
2020-09-15 12:20:10 +08:00
changbetty
2817fa8e44 [Testing] Use AndroidJUnit4 instead in TelephonyBasePreferenceControllerTest
1. Use AndroidJunit4 instead of RobolectricTestRunner
2. Use ApplicationProvider instead of RuntimeEnvironment to get context
3. Change Copy Right

Bug: 164986221
Test: atest -c TelephonyBasePreferenceControllerTest
Merged-In: Iabe24aef0b7a5c3aa9d7be275f0c4ed552cdd2e8
Change-Id: I96e99506b534dbe7fc9e66739295e09fc543663f
2020-09-15 12:12:31 +08:00
Jeremy Goldman
0c48f53cfe [Testing] use AndroidJUnit4 in new EuiccPreferenceControllerTest
Test: atest -c EuiccPreferenceControllerTest
Merged-In: I028ca81d38252beb3abccef9e938988510f3f55e
Change-Id: I5fcd2f3e9d2e845ec9e1e2693c10330e4292fb7a
2020-09-15 12:05:44 +08:00