Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 1 | // Copyright (C) 2017 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 14 | |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 15 | #include "src/condition/SimpleConditionTracker.h" |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 16 | #include "tests/statsd_test_util.h" |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 17 | |
| 18 | #include <gmock/gmock.h> |
| 19 | #include <gtest/gtest.h> |
| 20 | #include <stdio.h> |
| 21 | #include <vector> |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 22 | #include <numeric> |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 23 | |
| 24 | using std::map; |
| 25 | using std::unordered_map; |
| 26 | using std::vector; |
| 27 | |
| 28 | #ifdef __ANDROID__ |
| 29 | |
| 30 | namespace android { |
| 31 | namespace os { |
| 32 | namespace statsd { |
| 33 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 34 | const ConfigKey kConfigKey(0, 12345); |
Yao Chen | b356151 | 2017-11-21 18:07:17 -0800 | [diff] [blame] | 35 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 36 | const int ATTRIBUTION_NODE_FIELD_ID = 1; |
| 37 | const int ATTRIBUTION_UID_FIELD_ID = 1; |
| 38 | const int TAG_ID = 1; |
| 39 | |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 40 | SimplePredicate getWakeLockHeldCondition(bool countNesting, bool defaultFalse, |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 41 | bool outputSlicedUid, Position position) { |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 42 | SimplePredicate simplePredicate; |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 43 | simplePredicate.set_start(StringToId("WAKE_LOCK_ACQUIRE")); |
| 44 | simplePredicate.set_stop(StringToId("WAKE_LOCK_RELEASE")); |
| 45 | simplePredicate.set_stop_all(StringToId("RELEASE_ALL")); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 46 | if (outputSlicedUid) { |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 47 | simplePredicate.mutable_dimensions()->set_field(TAG_ID); |
| 48 | simplePredicate.mutable_dimensions()->add_child()->set_field(ATTRIBUTION_NODE_FIELD_ID); |
| 49 | simplePredicate.mutable_dimensions()->mutable_child(0)->set_position(position); |
| 50 | simplePredicate.mutable_dimensions()->mutable_child(0)->add_child()->set_field( |
| 51 | ATTRIBUTION_UID_FIELD_ID); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 52 | } |
| 53 | |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 54 | simplePredicate.set_count_nesting(countNesting); |
| 55 | simplePredicate.set_initial_value(defaultFalse ? SimplePredicate_InitialValue_FALSE |
| 56 | : SimplePredicate_InitialValue_UNKNOWN); |
| 57 | return simplePredicate; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 58 | } |
| 59 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 60 | void writeAttributionNodesToEvent(LogEvent* event, const std::vector<int> &uids) { |
| 61 | std::vector<AttributionNode> nodes; |
| 62 | for (size_t i = 0; i < uids.size(); ++i) { |
| 63 | AttributionNode node; |
| 64 | node.set_uid(uids[i]); |
| 65 | nodes.push_back(node); |
| 66 | } |
| 67 | event->write(nodes); // attribution chain. |
| 68 | } |
| 69 | |
| 70 | void makeWakeLockEvent( |
| 71 | LogEvent* event, const std::vector<int> &uids, const string& wl, int acquire) { |
| 72 | writeAttributionNodesToEvent(event, uids); |
Yao Chen | 8023540 | 2017-11-13 20:42:25 -0800 | [diff] [blame] | 73 | event->write(wl); |
| 74 | event->write(acquire); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 75 | event->init(); |
| 76 | } |
| 77 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 78 | std::map<int64_t, std::vector<HashableDimensionKey>> getWakeLockQueryKey( |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 79 | const Position position, |
| 80 | const std::vector<int> &uids, const string& conditionName) { |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 81 | std::map<int64_t, std::vector<HashableDimensionKey>> outputKeyMap; |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 82 | std::vector<int> uid_indexes; |
| 83 | switch(position) { |
| 84 | case Position::FIRST: |
| 85 | uid_indexes.push_back(0); |
| 86 | break; |
| 87 | case Position::LAST: |
| 88 | uid_indexes.push_back(uids.size() - 1); |
| 89 | break; |
| 90 | case Position::ANY: |
| 91 | uid_indexes.resize(uids.size()); |
| 92 | std::iota(uid_indexes.begin(), uid_indexes.end(), 0); |
| 93 | break; |
| 94 | default: |
| 95 | break; |
| 96 | } |
| 97 | |
| 98 | for (const int idx : uid_indexes) { |
| 99 | DimensionsValue dimensionsValue; |
| 100 | dimensionsValue.set_field(TAG_ID); |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 101 | dimensionsValue.mutable_value_tuple()->add_dimensions_value()->set_field( |
| 102 | ATTRIBUTION_NODE_FIELD_ID); |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 103 | dimensionsValue.mutable_value_tuple()->mutable_dimensions_value(0) |
| 104 | ->mutable_value_tuple()->add_dimensions_value()->set_field(ATTRIBUTION_NODE_FIELD_ID); |
| 105 | dimensionsValue.mutable_value_tuple()->mutable_dimensions_value(0) |
| 106 | ->mutable_value_tuple()->mutable_dimensions_value(0)->set_value_int(uids[idx]); |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 107 | outputKeyMap[StringToId(conditionName)].push_back(HashableDimensionKey(dimensionsValue)); |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 108 | } |
| 109 | return outputKeyMap; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | TEST(SimpleConditionTrackerTest, TestNonSlicedCondition) { |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 113 | SimplePredicate simplePredicate; |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 114 | simplePredicate.set_start(StringToId("SCREEN_TURNED_ON")); |
| 115 | simplePredicate.set_stop(StringToId("SCREEN_TURNED_OFF")); |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 116 | simplePredicate.set_count_nesting(false); |
| 117 | simplePredicate.set_initial_value(SimplePredicate_InitialValue_UNKNOWN); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 118 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 119 | unordered_map<int64_t, int> trackerNameIndexMap; |
| 120 | trackerNameIndexMap[StringToId("SCREEN_TURNED_ON")] = 0; |
| 121 | trackerNameIndexMap[StringToId("SCREEN_TURNED_OFF")] = 1; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 122 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 123 | SimpleConditionTracker conditionTracker(kConfigKey, StringToId("SCREEN_IS_ON"), 0 /*tracker index*/, |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 124 | simplePredicate, trackerNameIndexMap); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 125 | |
| 126 | LogEvent event(1 /*tagId*/, 0 /*timestamp*/); |
| 127 | |
| 128 | vector<MatchingState> matcherState; |
| 129 | matcherState.push_back(MatchingState::kNotMatched); |
| 130 | matcherState.push_back(MatchingState::kNotMatched); |
| 131 | |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 132 | vector<sp<ConditionTracker>> allPredicates; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 133 | vector<ConditionState> conditionCache(1, ConditionState::kNotEvaluated); |
| 134 | vector<bool> changedCache(1, false); |
| 135 | |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 136 | conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 137 | changedCache); |
| 138 | // not matched start or stop. condition doesn't change |
| 139 | EXPECT_EQ(ConditionState::kUnknown, conditionCache[0]); |
| 140 | EXPECT_FALSE(changedCache[0]); |
| 141 | |
| 142 | // prepare a case for match start. |
| 143 | matcherState.clear(); |
| 144 | matcherState.push_back(MatchingState::kMatched); |
| 145 | matcherState.push_back(MatchingState::kNotMatched); |
| 146 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 147 | changedCache[0] = false; |
| 148 | |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 149 | conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 150 | changedCache); |
| 151 | // now condition should change to true. |
| 152 | EXPECT_EQ(ConditionState::kTrue, conditionCache[0]); |
| 153 | EXPECT_TRUE(changedCache[0]); |
| 154 | |
Yao Chen | d41c422 | 2017-11-15 19:26:14 -0800 | [diff] [blame] | 155 | // match nothing. |
| 156 | matcherState.clear(); |
| 157 | matcherState.push_back(MatchingState::kNotMatched); |
| 158 | matcherState.push_back(MatchingState::kNotMatched); |
| 159 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 160 | changedCache[0] = false; |
| 161 | |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 162 | conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, |
Yao Chen | d41c422 | 2017-11-15 19:26:14 -0800 | [diff] [blame] | 163 | changedCache); |
| 164 | EXPECT_EQ(ConditionState::kTrue, conditionCache[0]); |
| 165 | EXPECT_FALSE(changedCache[0]); |
| 166 | |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 167 | // the case for match stop. |
| 168 | matcherState.clear(); |
| 169 | matcherState.push_back(MatchingState::kNotMatched); |
| 170 | matcherState.push_back(MatchingState::kMatched); |
| 171 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 172 | changedCache[0] = false; |
| 173 | |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 174 | conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 175 | changedCache); |
| 176 | |
| 177 | // condition changes to false. |
| 178 | EXPECT_EQ(ConditionState::kFalse, conditionCache[0]); |
| 179 | EXPECT_TRUE(changedCache[0]); |
| 180 | |
| 181 | // match stop again. |
| 182 | matcherState.clear(); |
| 183 | matcherState.push_back(MatchingState::kNotMatched); |
| 184 | matcherState.push_back(MatchingState::kMatched); |
| 185 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 186 | changedCache[0] = false; |
| 187 | |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 188 | conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 189 | changedCache); |
| 190 | // condition should still be false. not changed. |
| 191 | EXPECT_EQ(ConditionState::kFalse, conditionCache[0]); |
| 192 | EXPECT_FALSE(changedCache[0]); |
| 193 | } |
| 194 | |
| 195 | TEST(SimpleConditionTrackerTest, TestNonSlicedConditionNestCounting) { |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 196 | SimplePredicate simplePredicate; |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 197 | simplePredicate.set_start(StringToId("SCREEN_TURNED_ON")); |
| 198 | simplePredicate.set_stop(StringToId("SCREEN_TURNED_OFF")); |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 199 | simplePredicate.set_count_nesting(true); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 200 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 201 | unordered_map<int64_t, int> trackerNameIndexMap; |
| 202 | trackerNameIndexMap[StringToId("SCREEN_TURNED_ON")] = 0; |
| 203 | trackerNameIndexMap[StringToId("SCREEN_TURNED_OFF")] = 1; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 204 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 205 | SimpleConditionTracker conditionTracker(kConfigKey, StringToId("SCREEN_IS_ON"), |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 206 | 0 /*condition tracker index*/, simplePredicate, |
Yao Chen | b356151 | 2017-11-21 18:07:17 -0800 | [diff] [blame] | 207 | trackerNameIndexMap); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 208 | |
| 209 | LogEvent event(1 /*tagId*/, 0 /*timestamp*/); |
| 210 | |
| 211 | // one matched start |
| 212 | vector<MatchingState> matcherState; |
| 213 | matcherState.push_back(MatchingState::kMatched); |
| 214 | matcherState.push_back(MatchingState::kNotMatched); |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 215 | vector<sp<ConditionTracker>> allPredicates; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 216 | vector<ConditionState> conditionCache(1, ConditionState::kNotEvaluated); |
| 217 | vector<bool> changedCache(1, false); |
| 218 | |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 219 | conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 220 | changedCache); |
| 221 | |
| 222 | EXPECT_EQ(ConditionState::kTrue, conditionCache[0]); |
| 223 | EXPECT_TRUE(changedCache[0]); |
| 224 | |
| 225 | // prepare for another matched start. |
| 226 | matcherState.clear(); |
| 227 | matcherState.push_back(MatchingState::kMatched); |
| 228 | matcherState.push_back(MatchingState::kNotMatched); |
| 229 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 230 | changedCache[0] = false; |
| 231 | |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 232 | conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 233 | changedCache); |
| 234 | |
| 235 | EXPECT_EQ(ConditionState::kTrue, conditionCache[0]); |
| 236 | EXPECT_FALSE(changedCache[0]); |
| 237 | |
| 238 | // ONE MATCHED STOP |
| 239 | matcherState.clear(); |
| 240 | matcherState.push_back(MatchingState::kNotMatched); |
| 241 | matcherState.push_back(MatchingState::kMatched); |
| 242 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 243 | changedCache[0] = false; |
| 244 | |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 245 | conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 246 | changedCache); |
| 247 | // result should still be true |
| 248 | EXPECT_EQ(ConditionState::kTrue, conditionCache[0]); |
| 249 | EXPECT_FALSE(changedCache[0]); |
| 250 | |
| 251 | // ANOTHER MATCHED STOP |
| 252 | matcherState.clear(); |
| 253 | matcherState.push_back(MatchingState::kNotMatched); |
| 254 | matcherState.push_back(MatchingState::kMatched); |
| 255 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 256 | changedCache[0] = false; |
| 257 | |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 258 | conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 259 | changedCache); |
| 260 | // result should still be true |
| 261 | EXPECT_EQ(ConditionState::kFalse, conditionCache[0]); |
| 262 | EXPECT_TRUE(changedCache[0]); |
| 263 | } |
| 264 | |
| 265 | TEST(SimpleConditionTrackerTest, TestSlicedCondition) { |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 266 | for (Position position : |
| 267 | { Position::ANY, Position::FIRST, Position::LAST}) { |
| 268 | SimplePredicate simplePredicate = getWakeLockHeldCondition( |
| 269 | true /*nesting*/, true /*default to false*/, true /*output slice by uid*/, |
| 270 | position); |
| 271 | string conditionName = "WL_HELD_BY_UID2"; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 272 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 273 | unordered_map<int64_t, int> trackerNameIndexMap; |
| 274 | trackerNameIndexMap[StringToId("WAKE_LOCK_ACQUIRE")] = 0; |
| 275 | trackerNameIndexMap[StringToId("WAKE_LOCK_RELEASE")] = 1; |
| 276 | trackerNameIndexMap[StringToId("RELEASE_ALL")] = 2; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 277 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 278 | SimpleConditionTracker conditionTracker(kConfigKey, StringToId(conditionName), |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 279 | 0 /*condition tracker index*/, simplePredicate, |
| 280 | trackerNameIndexMap); |
| 281 | std::vector<int> uids = {111, 222, 333}; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 282 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 283 | LogEvent event(1 /*tagId*/, 0 /*timestamp*/); |
| 284 | makeWakeLockEvent(&event, uids, "wl1", 1); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 285 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 286 | // one matched start |
| 287 | vector<MatchingState> matcherState; |
| 288 | matcherState.push_back(MatchingState::kMatched); |
| 289 | matcherState.push_back(MatchingState::kNotMatched); |
| 290 | matcherState.push_back(MatchingState::kNotMatched); |
| 291 | vector<sp<ConditionTracker>> allPredicates; |
| 292 | vector<ConditionState> conditionCache(1, ConditionState::kNotEvaluated); |
| 293 | vector<bool> changedCache(1, false); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 294 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 295 | conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, |
| 296 | changedCache); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 297 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 298 | if (position == Position::FIRST || |
| 299 | position == Position::LAST) { |
| 300 | EXPECT_EQ(1UL, conditionTracker.mSlicedConditionState.size()); |
| 301 | } else { |
| 302 | EXPECT_EQ(uids.size(), conditionTracker.mSlicedConditionState.size()); |
| 303 | } |
| 304 | EXPECT_TRUE(changedCache[0]); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 305 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 306 | // Now test query |
| 307 | const auto queryKey = getWakeLockQueryKey(position, uids, conditionName); |
| 308 | conditionCache[0] = ConditionState::kNotEvaluated; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 309 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 310 | conditionTracker.isConditionMet(queryKey, allPredicates, conditionCache); |
| 311 | EXPECT_EQ(ConditionState::kTrue, conditionCache[0]); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 312 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 313 | // another wake lock acquired by this uid |
| 314 | LogEvent event2(1 /*tagId*/, 0 /*timestamp*/); |
| 315 | makeWakeLockEvent(&event2, uids, "wl2", 1); |
| 316 | matcherState.clear(); |
| 317 | matcherState.push_back(MatchingState::kMatched); |
| 318 | matcherState.push_back(MatchingState::kNotMatched); |
| 319 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 320 | changedCache[0] = false; |
| 321 | conditionTracker.evaluateCondition(event2, matcherState, allPredicates, conditionCache, |
| 322 | changedCache); |
| 323 | EXPECT_FALSE(changedCache[0]); |
| 324 | if (position == Position::FIRST || |
| 325 | position == Position::LAST) { |
| 326 | EXPECT_EQ(1UL, conditionTracker.mSlicedConditionState.size()); |
| 327 | } else { |
| 328 | EXPECT_EQ(uids.size(), conditionTracker.mSlicedConditionState.size()); |
| 329 | } |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 330 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 331 | // wake lock 1 release |
| 332 | LogEvent event3(1 /*tagId*/, 0 /*timestamp*/); |
| 333 | makeWakeLockEvent(&event3, uids, "wl1", 0); // now release it. |
| 334 | matcherState.clear(); |
| 335 | matcherState.push_back(MatchingState::kNotMatched); |
| 336 | matcherState.push_back(MatchingState::kMatched); |
| 337 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 338 | changedCache[0] = false; |
| 339 | conditionTracker.evaluateCondition(event3, matcherState, allPredicates, conditionCache, |
| 340 | changedCache); |
| 341 | // nothing changes, because wake lock 2 is still held for this uid |
| 342 | EXPECT_FALSE(changedCache[0]); |
| 343 | if (position == Position::FIRST || |
| 344 | position == Position::LAST) { |
| 345 | EXPECT_EQ(1UL, conditionTracker.mSlicedConditionState.size()); |
| 346 | } else { |
| 347 | EXPECT_EQ(uids.size(), conditionTracker.mSlicedConditionState.size()); |
| 348 | } |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 349 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 350 | LogEvent event4(1 /*tagId*/, 0 /*timestamp*/); |
| 351 | makeWakeLockEvent(&event4, uids, "wl2", 0); // now release it. |
| 352 | matcherState.clear(); |
| 353 | matcherState.push_back(MatchingState::kNotMatched); |
| 354 | matcherState.push_back(MatchingState::kMatched); |
| 355 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 356 | changedCache[0] = false; |
| 357 | conditionTracker.evaluateCondition(event4, matcherState, allPredicates, conditionCache, |
| 358 | changedCache); |
| 359 | EXPECT_EQ(0UL, conditionTracker.mSlicedConditionState.size()); |
| 360 | EXPECT_TRUE(changedCache[0]); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 361 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 362 | // query again |
| 363 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 364 | conditionTracker.isConditionMet(queryKey, allPredicates, conditionCache); |
| 365 | EXPECT_EQ(ConditionState::kFalse, conditionCache[0]); |
| 366 | |
| 367 | } |
| 368 | |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 369 | } |
| 370 | |
| 371 | TEST(SimpleConditionTrackerTest, TestSlicedWithNoOutputDim) { |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 372 | SimplePredicate simplePredicate = getWakeLockHeldCondition( |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 373 | true /*nesting*/, true /*default to false*/, false /*slice output by uid*/, |
| 374 | Position::ANY /* position */); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 375 | string conditionName = "WL_HELD"; |
| 376 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 377 | unordered_map<int64_t, int> trackerNameIndexMap; |
| 378 | trackerNameIndexMap[StringToId("WAKE_LOCK_ACQUIRE")] = 0; |
| 379 | trackerNameIndexMap[StringToId("WAKE_LOCK_RELEASE")] = 1; |
| 380 | trackerNameIndexMap[StringToId("RELEASE_ALL")] = 2; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 381 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 382 | SimpleConditionTracker conditionTracker(kConfigKey, StringToId(conditionName), |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 383 | 0 /*condition tracker index*/, simplePredicate, |
Yao Chen | b356151 | 2017-11-21 18:07:17 -0800 | [diff] [blame] | 384 | trackerNameIndexMap); |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 385 | |
| 386 | std::vector<int> uid_list1 = {111, 1111, 11111}; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 387 | string uid1_wl1 = "wl1_1"; |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 388 | std::vector<int> uid_list2 = {222, 2222, 22222}; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 389 | string uid2_wl1 = "wl2_1"; |
| 390 | |
| 391 | LogEvent event(1 /*tagId*/, 0 /*timestamp*/); |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 392 | makeWakeLockEvent(&event, uid_list1, uid1_wl1, 1); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 393 | |
| 394 | // one matched start for uid1 |
| 395 | vector<MatchingState> matcherState; |
| 396 | matcherState.push_back(MatchingState::kMatched); |
| 397 | matcherState.push_back(MatchingState::kNotMatched); |
Yao Chen | 9975205 | 2017-11-27 11:40:45 -0800 | [diff] [blame] | 398 | matcherState.push_back(MatchingState::kNotMatched); |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 399 | vector<sp<ConditionTracker>> allPredicates; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 400 | vector<ConditionState> conditionCache(1, ConditionState::kNotEvaluated); |
| 401 | vector<bool> changedCache(1, false); |
| 402 | |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 403 | conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 404 | changedCache); |
| 405 | |
| 406 | EXPECT_EQ(1UL, conditionTracker.mSlicedConditionState.size()); |
| 407 | EXPECT_TRUE(changedCache[0]); |
| 408 | |
| 409 | // Now test query |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 410 | ConditionKey queryKey; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 411 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 412 | |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 413 | conditionTracker.isConditionMet(queryKey, allPredicates, conditionCache); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 414 | EXPECT_EQ(ConditionState::kTrue, conditionCache[0]); |
| 415 | |
| 416 | // another wake lock acquired by this uid |
| 417 | LogEvent event2(1 /*tagId*/, 0 /*timestamp*/); |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 418 | makeWakeLockEvent(&event2, uid_list2, uid2_wl1, 1); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 419 | matcherState.clear(); |
| 420 | matcherState.push_back(MatchingState::kMatched); |
| 421 | matcherState.push_back(MatchingState::kNotMatched); |
| 422 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 423 | changedCache[0] = false; |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 424 | conditionTracker.evaluateCondition(event2, matcherState, allPredicates, conditionCache, |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 425 | changedCache); |
| 426 | EXPECT_FALSE(changedCache[0]); |
| 427 | |
| 428 | // uid1 wake lock 1 release |
| 429 | LogEvent event3(1 /*tagId*/, 0 /*timestamp*/); |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 430 | makeWakeLockEvent(&event3, uid_list1, uid1_wl1, 0); // now release it. |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 431 | matcherState.clear(); |
| 432 | matcherState.push_back(MatchingState::kNotMatched); |
| 433 | matcherState.push_back(MatchingState::kMatched); |
| 434 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 435 | changedCache[0] = false; |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 436 | conditionTracker.evaluateCondition(event3, matcherState, allPredicates, conditionCache, |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 437 | changedCache); |
| 438 | // nothing changes, because uid2 is still holding wl. |
| 439 | EXPECT_FALSE(changedCache[0]); |
| 440 | |
| 441 | LogEvent event4(1 /*tagId*/, 0 /*timestamp*/); |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 442 | makeWakeLockEvent(&event4, uid_list2, uid2_wl1, 0); // now release it. |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 443 | matcherState.clear(); |
| 444 | matcherState.push_back(MatchingState::kNotMatched); |
| 445 | matcherState.push_back(MatchingState::kMatched); |
| 446 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 447 | changedCache[0] = false; |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 448 | conditionTracker.evaluateCondition(event4, matcherState, allPredicates, conditionCache, |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 449 | changedCache); |
| 450 | EXPECT_EQ(0UL, conditionTracker.mSlicedConditionState.size()); |
| 451 | EXPECT_TRUE(changedCache[0]); |
| 452 | |
| 453 | // query again |
| 454 | conditionCache[0] = ConditionState::kNotEvaluated; |
Stefan Lafon | 12d01fa | 2017-12-04 20:56:09 -0800 | [diff] [blame] | 455 | conditionTracker.isConditionMet(queryKey, allPredicates, conditionCache); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 456 | EXPECT_EQ(ConditionState::kFalse, conditionCache[0]); |
| 457 | } |
| 458 | |
| 459 | TEST(SimpleConditionTrackerTest, TestStopAll) { |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 460 | for (Position position : |
| 461 | {Position::ANY, Position::FIRST, Position::LAST}) { |
| 462 | SimplePredicate simplePredicate = getWakeLockHeldCondition( |
| 463 | true /*nesting*/, true /*default to false*/, true /*output slice by uid*/, |
| 464 | position); |
| 465 | string conditionName = "WL_HELD_BY_UID3"; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 466 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 467 | unordered_map<int64_t, int> trackerNameIndexMap; |
| 468 | trackerNameIndexMap[StringToId("WAKE_LOCK_ACQUIRE")] = 0; |
| 469 | trackerNameIndexMap[StringToId("WAKE_LOCK_RELEASE")] = 1; |
| 470 | trackerNameIndexMap[StringToId("RELEASE_ALL")] = 2; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 471 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame^] | 472 | SimpleConditionTracker conditionTracker(kConfigKey, StringToId(conditionName), |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 473 | 0 /*condition tracker index*/, simplePredicate, |
| 474 | trackerNameIndexMap); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 475 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 476 | std::vector<int> uid_list1 = {111, 1111, 11111}; |
| 477 | std::vector<int> uid_list2 = {222, 2222, 22222}; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 478 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 479 | LogEvent event(1 /*tagId*/, 0 /*timestamp*/); |
| 480 | makeWakeLockEvent(&event, uid_list1, "wl1", 1); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 481 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 482 | // one matched start |
| 483 | vector<MatchingState> matcherState; |
| 484 | matcherState.push_back(MatchingState::kMatched); |
| 485 | matcherState.push_back(MatchingState::kNotMatched); |
| 486 | matcherState.push_back(MatchingState::kNotMatched); |
| 487 | vector<sp<ConditionTracker>> allPredicates; |
| 488 | vector<ConditionState> conditionCache(1, ConditionState::kNotEvaluated); |
| 489 | vector<bool> changedCache(1, false); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 490 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 491 | conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, |
| 492 | changedCache); |
| 493 | if (position == Position::FIRST || |
| 494 | position == Position::LAST) { |
| 495 | EXPECT_EQ(1UL, conditionTracker.mSlicedConditionState.size()); |
| 496 | } else { |
| 497 | EXPECT_EQ(uid_list1.size(), conditionTracker.mSlicedConditionState.size()); |
| 498 | } |
| 499 | EXPECT_TRUE(changedCache[0]); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 500 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 501 | // Now test query |
| 502 | const auto queryKey = getWakeLockQueryKey(position, uid_list1, conditionName); |
| 503 | conditionCache[0] = ConditionState::kNotEvaluated; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 504 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 505 | conditionTracker.isConditionMet(queryKey, allPredicates, conditionCache); |
| 506 | EXPECT_EQ(ConditionState::kTrue, conditionCache[0]); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 507 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 508 | // another wake lock acquired by uid2 |
| 509 | LogEvent event2(1 /*tagId*/, 0 /*timestamp*/); |
| 510 | makeWakeLockEvent(&event2, uid_list2, "wl2", 1); |
| 511 | matcherState.clear(); |
| 512 | matcherState.push_back(MatchingState::kMatched); |
| 513 | matcherState.push_back(MatchingState::kNotMatched); |
| 514 | matcherState.push_back(MatchingState::kNotMatched); |
| 515 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 516 | changedCache[0] = false; |
| 517 | conditionTracker.evaluateCondition(event2, matcherState, allPredicates, conditionCache, |
| 518 | changedCache); |
| 519 | if (position == Position::FIRST || |
| 520 | position == Position::LAST) { |
| 521 | EXPECT_EQ(2UL, conditionTracker.mSlicedConditionState.size()); |
| 522 | } else { |
| 523 | EXPECT_EQ(uid_list1.size() + uid_list2.size(), |
| 524 | conditionTracker.mSlicedConditionState.size()); |
| 525 | } |
| 526 | EXPECT_TRUE(changedCache[0]); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 527 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 528 | // TEST QUERY |
| 529 | const auto queryKey2 = getWakeLockQueryKey(position, uid_list2, conditionName); |
| 530 | conditionCache[0] = ConditionState::kNotEvaluated; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 531 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 532 | conditionTracker.isConditionMet(queryKey, allPredicates, conditionCache); |
| 533 | EXPECT_EQ(ConditionState::kTrue, conditionCache[0]); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 534 | |
| 535 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 536 | // stop all event |
| 537 | LogEvent event3(2 /*tagId*/, 0 /*timestamp*/); |
| 538 | matcherState.clear(); |
| 539 | matcherState.push_back(MatchingState::kNotMatched); |
| 540 | matcherState.push_back(MatchingState::kNotMatched); |
| 541 | matcherState.push_back(MatchingState::kMatched); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 542 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 543 | conditionCache[0] = ConditionState::kNotEvaluated; |
| 544 | changedCache[0] = false; |
| 545 | conditionTracker.evaluateCondition(event3, matcherState, allPredicates, conditionCache, |
| 546 | changedCache); |
| 547 | EXPECT_TRUE(changedCache[0]); |
| 548 | EXPECT_EQ(0UL, conditionTracker.mSlicedConditionState.size()); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 549 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 550 | // TEST QUERY |
| 551 | const auto queryKey3 = getWakeLockQueryKey(position, uid_list1, conditionName); |
| 552 | conditionCache[0] = ConditionState::kNotEvaluated; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 553 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 554 | conditionTracker.isConditionMet(queryKey, allPredicates, conditionCache); |
| 555 | EXPECT_EQ(ConditionState::kFalse, conditionCache[0]); |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 556 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 557 | // TEST QUERY |
| 558 | const auto queryKey4 = getWakeLockQueryKey(position, uid_list2, conditionName); |
| 559 | conditionCache[0] = ConditionState::kNotEvaluated; |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 560 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 561 | conditionTracker.isConditionMet(queryKey, allPredicates, conditionCache); |
| 562 | EXPECT_EQ(ConditionState::kFalse, conditionCache[0]); |
| 563 | } |
| 564 | |
Yao Chen | 967b205 | 2017-11-07 16:36:43 -0800 | [diff] [blame] | 565 | } |
| 566 | |
| 567 | } // namespace statsd |
| 568 | } // namespace os |
| 569 | } // namespace android |
| 570 | #else |
| 571 | GTEST_LOG_(INFO) << "This test does nothing.\n"; |
| 572 | #endif |