Fix OdRefreshTest.CompileSetsCompilerFilter.

The test had two problems:
1. It was unexpectedly skipped on most of the devices because of a
   wrong check.
2. On devices where the test was not skipped, the test was failing
   because some uninteresting calls were not covered by EXPECT_CALL.

This CL fixes these problems.

Bug: 207648082
Test: atest art_standalone_odrefresh_tests
Change-Id: If1d030f4f782e40b72b6d5e27a7f2cbc458b86a1
diff --git a/odrefresh/odrefresh_test.cc b/odrefresh/odrefresh_test.cc
index dabfeb0..a19ce92 100644
--- a/odrefresh/odrefresh_test.cc
+++ b/odrefresh/odrefresh_test.cc
@@ -16,7 +16,6 @@
 
 #include "odrefresh.h"
 
-#include <sys/system_properties.h>
 #include <unistd.h>
 
 #include <functional>
@@ -310,19 +309,29 @@
 }
 
 TEST_F(OdRefreshTest, CompileSetsCompilerFilter) {
-  // This test depends on a system property that doesn't exist on old platforms. Since the whole
-  // odrefresh program is for S and later, we don't need to run the test on old platforms.
-  if (__system_property_find("dalvik.vm.systemservercompilerfilter") == nullptr) {
-    return;
+  {
+    // Check if the system property can be written.
+    auto guard = ScopedSetProperty("dalvik.vm.systemservercompilerfilter", "foo");
+    if (android::base::GetProperty("dalvik.vm.systemservercompilerfilter", /*default_value=*/{}) !=
+        "foo") {
+      // This test depends on a system property that doesn't exist on old platforms. Since the whole
+      // odrefresh program is for S and later, we don't need to run the test on old platforms.
+      return;
+    }
   }
 
   {
     auto [odrefresh, mock_odr_dexopt] = CreateOdRefresh();
-    ON_CALL(*mock_odr_dexopt, DoDexoptSystemServer(_)).WillByDefault(Return(0));
 
     // Test setup: default compiler filter should be "speed".
     auto guard = ScopedSetProperty("dalvik.vm.systemservercompilerfilter", "");
 
+    // Uninteresting calls.
+    EXPECT_CALL(*mock_odr_dexopt, DoDexoptSystemServer(_))
+        .Times(odrefresh->AllSystemServerJars().size() - 2)
+        .WillRepeatedly(Return(0))
+        .RetiresOnSaturation();
+
     EXPECT_CALL(*mock_odr_dexopt,
                 DoDexoptSystemServer(AllOf(
                     Field(&DexoptSystemServerArgs::dexPath, Eq(location_provider_jar_)),
@@ -350,6 +359,12 @@
     // profile, otherwise fallback to speed.
     auto guard = ScopedSetProperty("dalvik.vm.systemservercompilerfilter", "speed-profile");
 
+    // Uninteresting calls.
+    EXPECT_CALL(*mock_odr_dexopt, DoDexoptSystemServer(_))
+        .Times(odrefresh->AllSystemServerJars().size() - 2)
+        .WillRepeatedly(Return(0))
+        .RetiresOnSaturation();
+
     // services.jar has a profile, while location.provider.jar does not.
     EXPECT_CALL(
         *mock_odr_dexopt,
@@ -379,6 +394,12 @@
     // Test setup: "verify" compiler filter should be simply applied.
     auto guard = ScopedSetProperty("dalvik.vm.systemservercompilerfilter", "verify");
 
+    // Uninteresting calls.
+    EXPECT_CALL(*mock_odr_dexopt, DoDexoptSystemServer(_))
+        .Times(odrefresh->AllSystemServerJars().size() - 2)
+        .WillRepeatedly(Return(0))
+        .RetiresOnSaturation();
+
     EXPECT_CALL(*mock_odr_dexopt,
                 DoDexoptSystemServer(AllOf(
                     Field(&DexoptSystemServerArgs::dexPath, Eq(location_provider_jar_)),