OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
| 5 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h" |
| 6 |
5 #include <string> | 7 #include <string> |
6 | 8 |
7 #include "base/basictypes.h" | 9 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
9 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
| 12 #include "base/prefs/pref_registry_simple.h" |
| 13 #include "base/prefs/testing_pref_service.h" |
10 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "base/test/test_simple_task_runner.h" |
11 #include "base/threading/sequenced_worker_pool.h" | 16 #include "base/threading/sequenced_worker_pool.h" |
12 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h" | 17 #include "base/values.h" |
| 18 #include "chrome/browser/profile_resetter/automatic_profile_resetter_delegate.h" |
13 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" | 19 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" |
14 #include "chrome/browser/profile_resetter/automatic_profile_resetter_mementos.h" | 20 #include "chrome/browser/profile_resetter/automatic_profile_resetter_mementos.h" |
15 #include "chrome/browser/profile_resetter/jtl_foundation.h" | 21 #include "chrome/browser/profile_resetter/jtl_foundation.h" |
16 #include "chrome/browser/profile_resetter/jtl_instructions.h" | 22 #include "chrome/browser/profile_resetter/jtl_instructions.h" |
17 #include "chrome/test/base/scoped_testing_local_state.h" | 23 #include "chrome/test/base/scoped_testing_local_state.h" |
18 #include "chrome/test/base/testing_browser_process.h" | 24 #include "chrome/test/base/testing_browser_process.h" |
| 25 #include "chrome/test/base/testing_pref_service_syncable.h" |
19 #include "chrome/test/base/testing_profile.h" | 26 #include "chrome/test/base/testing_profile.h" |
| 27 #include "components/user_prefs/pref_registry_syncable.h" |
20 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/test/test_browser_thread_bundle.h" | 29 #include "content/public/test/test_browser_thread_bundle.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 30 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
24 | 32 |
| 33 using testing::_; |
| 34 using testing::Invoke; |
| 35 using testing::Return; |
| 36 |
25 namespace { | 37 namespace { |
26 | 38 |
27 const char kAutomaticProfileResetStudyName[] = "AutomaticProfileReset"; | 39 const char kAutomaticProfileResetStudyName[] = "AutomaticProfileReset"; |
28 const char kStudyDisabledGroupName[] = "Disabled"; | 40 const char kStudyDisabledGroupName[] = "Disabled"; |
29 const char kStudyDryRunGroupName[] = "DryRun"; | 41 const char kStudyDryRunGroupName[] = "DryRun"; |
30 const char kStudyEnabledGroupName[] = "Enabled"; | 42 const char kStudyEnabledGroupName[] = "Enabled"; |
31 | 43 |
32 const char kTestHashSeed[] = "testing-hash-seed"; | 44 const char kTestHashSeed[] = "testing-hash-seed"; |
33 const char kTestMementoValue[] = "01234567890123456789012345678901"; | 45 const char kTestMementoValue[] = "01234567890123456789012345678901"; |
34 const char kTestInvalidMementoValue[] = "12345678901234567890123456789012"; | 46 const char kTestInvalidMementoValue[] = "12345678901234567890123456789012"; |
35 | 47 |
| 48 const char kTestPreferencePath[] = "testing.preference"; |
| 49 const char kTestPreferenceValue[] = "testing-preference-value"; |
| 50 |
| 51 const char kSearchURLAttributeKey[] = "search_url"; |
| 52 const char kTestSearchURL[] = "http://example.com/search?q={searchTerms}"; |
| 53 const char kTestSearchURL2[] = "http://google.com/?q={searchTerms}"; |
| 54 |
| 55 const char kTestModuleDigest[] = "01234567890123456789012345678901"; |
| 56 const char kTestModuleDigest2[] = "12345678901234567890123456789012"; |
| 57 |
36 // Helpers ------------------------------------------------------------------ | 58 // Helpers ------------------------------------------------------------------ |
37 | 59 |
| 60 // A testing version of the AutomaticProfileResetter that differs from the real |
| 61 // one only in that it has its statistics reporting mocked out for verification. |
| 62 class AutomaticProfileResetterUnderTest : public AutomaticProfileResetter { |
| 63 public: |
| 64 explicit AutomaticProfileResetterUnderTest(Profile* profile) |
| 65 : AutomaticProfileResetter(profile) {} |
| 66 virtual ~AutomaticProfileResetterUnderTest() {} |
| 67 |
| 68 MOCK_METHOD2(ReportStatistics, void(uint32, uint32)); |
| 69 |
| 70 private: |
| 71 DISALLOW_COPY_AND_ASSIGN(AutomaticProfileResetterUnderTest); |
| 72 }; |
| 73 |
38 class MockProfileResetterDelegate : public AutomaticProfileResetterDelegate { | 74 class MockProfileResetterDelegate : public AutomaticProfileResetterDelegate { |
39 public: | 75 public: |
40 MockProfileResetterDelegate() {} | 76 MockProfileResetterDelegate() |
| 77 : emulated_default_search_provider_is_managed_(false) {} |
41 virtual ~MockProfileResetterDelegate() {} | 78 virtual ~MockProfileResetterDelegate() {} |
42 | 79 |
| 80 MOCK_METHOD0(EnumerateLoadedModulesIfNeeded, void()); |
| 81 MOCK_CONST_METHOD1(RequestCallbackWhenLoadedModulesAreEnumerated, |
| 82 void(const base::Closure&)); |
| 83 |
| 84 MOCK_METHOD0(LoadTemplateURLServiceIfNeeded, void()); |
| 85 MOCK_CONST_METHOD1(RequestCallbackWhenTemplateURLServiceIsLoaded, |
| 86 void(const base::Closure&)); |
| 87 |
| 88 MOCK_CONST_METHOD0(OnGetLoadedModuleNameDigestsCalled, void()); |
| 89 MOCK_CONST_METHOD0(OnGetDefaultSearchProviderDetailsCalled, void()); |
| 90 MOCK_CONST_METHOD0(OnIsDefaultSearchProviderManagedCalled, void()); |
| 91 MOCK_CONST_METHOD0(OnGetPrepopulatedSearchProvidersDetailsCalled, void()); |
| 92 |
43 MOCK_METHOD0(ShowPrompt, void()); | 93 MOCK_METHOD0(ShowPrompt, void()); |
44 MOCK_METHOD2(ReportStatistics, void(uint32, uint32)); | 94 |
| 95 virtual scoped_ptr<base::ListValue> |
| 96 GetLoadedModuleNameDigests() const OVERRIDE { |
| 97 OnGetLoadedModuleNameDigestsCalled(); |
| 98 return scoped_ptr<base::ListValue>( |
| 99 emulated_loaded_module_digests_.DeepCopy()); |
| 100 } |
| 101 |
| 102 virtual scoped_ptr<base::DictionaryValue> |
| 103 GetDefaultSearchProviderDetails() const OVERRIDE { |
| 104 OnGetDefaultSearchProviderDetailsCalled(); |
| 105 return scoped_ptr<base::DictionaryValue>( |
| 106 emulated_default_search_provider_details_.DeepCopy()); |
| 107 } |
| 108 |
| 109 virtual bool IsDefaultSearchProviderManaged() const OVERRIDE { |
| 110 OnIsDefaultSearchProviderManagedCalled(); |
| 111 return emulated_default_search_provider_is_managed_; |
| 112 } |
| 113 |
| 114 virtual scoped_ptr<base::ListValue> |
| 115 GetPrepopulatedSearchProvidersDetails() const OVERRIDE { |
| 116 OnGetPrepopulatedSearchProvidersDetailsCalled(); |
| 117 return scoped_ptr<base::ListValue>( |
| 118 emulated_search_providers_details_.DeepCopy()); |
| 119 } |
| 120 |
| 121 static void ClosureInvoker(const base::Closure& closure) { closure.Run(); } |
| 122 |
| 123 void ExpectCallsToDependenciesSetUpMethods() { |
| 124 EXPECT_CALL(*this, EnumerateLoadedModulesIfNeeded()); |
| 125 EXPECT_CALL(*this, LoadTemplateURLServiceIfNeeded()); |
| 126 EXPECT_CALL(*this, RequestCallbackWhenLoadedModulesAreEnumerated(_)) |
| 127 .WillOnce(Invoke(ClosureInvoker)); |
| 128 EXPECT_CALL(*this, RequestCallbackWhenTemplateURLServiceIsLoaded(_)) |
| 129 .WillOnce(Invoke(ClosureInvoker)); |
| 130 } |
| 131 |
| 132 void ExpectCallsToGetterMethods() { |
| 133 EXPECT_CALL(*this, OnGetLoadedModuleNameDigestsCalled()); |
| 134 EXPECT_CALL(*this, OnGetDefaultSearchProviderDetailsCalled()); |
| 135 EXPECT_CALL(*this, OnIsDefaultSearchProviderManagedCalled()); |
| 136 EXPECT_CALL(*this, OnGetPrepopulatedSearchProvidersDetailsCalled()); |
| 137 } |
| 138 |
| 139 base::DictionaryValue& emulated_default_search_provider_details() { |
| 140 return emulated_default_search_provider_details_; |
| 141 } |
| 142 |
| 143 base::ListValue& emulated_search_providers_details() { |
| 144 return emulated_search_providers_details_; |
| 145 } |
| 146 |
| 147 base::ListValue& emulated_loaded_module_digests() { |
| 148 return emulated_loaded_module_digests_; |
| 149 } |
| 150 |
| 151 void set_emulated_default_search_provider_is_managed(bool value) { |
| 152 emulated_default_search_provider_is_managed_ = value; |
| 153 } |
45 | 154 |
46 private: | 155 private: |
| 156 base::DictionaryValue emulated_default_search_provider_details_; |
| 157 base::ListValue emulated_search_providers_details_; |
| 158 base::ListValue emulated_loaded_module_digests_; |
| 159 bool emulated_default_search_provider_is_managed_; |
| 160 |
47 DISALLOW_COPY_AND_ASSIGN(MockProfileResetterDelegate); | 161 DISALLOW_COPY_AND_ASSIGN(MockProfileResetterDelegate); |
48 }; | 162 }; |
49 | 163 |
50 class FileHostedPromptMementoSynchronous : protected FileHostedPromptMemento { | 164 class FileHostedPromptMementoSynchronous : protected FileHostedPromptMemento { |
51 public: | 165 public: |
52 explicit FileHostedPromptMementoSynchronous(Profile* profile) | 166 explicit FileHostedPromptMementoSynchronous(Profile* profile) |
53 : FileHostedPromptMemento(profile) {} | 167 : FileHostedPromptMemento(profile) {} |
54 | 168 |
55 std::string ReadValue() const { | 169 std::string ReadValue() const { |
56 std::string result; | 170 std::string result; |
(...skipping 15 matching lines...) Expand all Loading... |
72 DISALLOW_COPY_AND_ASSIGN(FileHostedPromptMementoSynchronous); | 186 DISALLOW_COPY_AND_ASSIGN(FileHostedPromptMementoSynchronous); |
73 }; | 187 }; |
74 | 188 |
75 std::string GetHash(const std::string& input) { | 189 std::string GetHash(const std::string& input) { |
76 return jtl_foundation::Hasher(kTestHashSeed).GetHash(input); | 190 return jtl_foundation::Hasher(kTestHashSeed).GetHash(input); |
77 } | 191 } |
78 | 192 |
79 // Encodes a Boolean argument value into JTL bytecode. | 193 // Encodes a Boolean argument value into JTL bytecode. |
80 std::string EncodeBool(bool value) { return value ? VALUE_TRUE : VALUE_FALSE; } | 194 std::string EncodeBool(bool value) { return value ? VALUE_TRUE : VALUE_FALSE; } |
81 | 195 |
82 // Constructs a simple evaluation program to test that input/output works well. | 196 // Constructs a simple evaluation program to test that basic input/output works |
83 // It will emulate a scenario in which the reset criteria are satisfied as | 197 // well. It will emulate a scenario in which the reset criteria are satisfied as |
84 // prescribed by |emulate_satisfied_criterion_{1|2}|, and will set bits in the | 198 // prescribed by |emulate_satisfied_criterion_{1|2}|, and will set bits in the |
85 // combined status mask according to whether or not the memento values received | 199 // combined status mask according to whether or not the memento values received |
86 // in the input were as expected. | 200 // in the input were as expected. |
87 // | 201 // |
88 // More specifically, the output of the program will be as follows: | 202 // More specifically, the output of the program will be as follows: |
89 // { | 203 // { |
90 // "satisfied_criteria_mask_bit1": emulate_satisfied_criterion_1, | 204 // "satisfied_criteria_mask_bit1": emulate_satisfied_criterion_1, |
91 // "satisfied_criteria_mask_bit2": emulate_satisfied_criterion_2, | 205 // "satisfied_criteria_mask_bit2": emulate_satisfied_criterion_2, |
92 // "combined_status_mask_bit1": | 206 // "combined_status_mask_bit1": |
93 // (emulate_satisfied_criterion_1 || emulate_satisfied_criterion_2), | 207 // (emulate_satisfied_criterion_1 || emulate_satisfied_criterion_2), |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 bytecode += OP_END_OF_SENTENCE; | 249 bytecode += OP_END_OF_SENTENCE; |
136 bytecode += OP_STORE_HASH(GetHash("memento_value_in_local_state"), | 250 bytecode += OP_STORE_HASH(GetHash("memento_value_in_local_state"), |
137 kTestMementoValue); | 251 kTestMementoValue); |
138 bytecode += OP_END_OF_SENTENCE; | 252 bytecode += OP_END_OF_SENTENCE; |
139 bytecode += OP_STORE_HASH(GetHash("memento_value_in_file"), | 253 bytecode += OP_STORE_HASH(GetHash("memento_value_in_file"), |
140 kTestMementoValue); | 254 kTestMementoValue); |
141 bytecode += OP_END_OF_SENTENCE; | 255 bytecode += OP_END_OF_SENTENCE; |
142 return bytecode; | 256 return bytecode; |
143 } | 257 } |
144 | 258 |
| 259 // Constructs another evaluation program to specifically test that local state |
| 260 // and user preference values are included in the input as expected. We will |
| 261 // re-purpose the output bitmasks to channel out information about the outcome |
| 262 // of the checks. |
| 263 // |
| 264 // More specifically, the output of the program will be as follows: |
| 265 // { |
| 266 // "combined_status_mask_bit1": |
| 267 // (input["preferences.testing.preference"] == kTestPreferenceValue) |
| 268 // "combined_status_mask_bit2": |
| 269 // (input["local_state.testing.preference"] == kTestPreferenceValue) |
| 270 // "combined_status_mask_bit3": input["preferences_iuc.testing.preference"] |
| 271 // "combined_status_mask_bit4": input["local_state_iuc.testing.preference"] |
| 272 // } |
| 273 std::string ConstructProgramToCheckPreferences() { |
| 274 std::string bytecode; |
| 275 bytecode += OP_NAVIGATE(GetHash("preferences")); |
| 276 bytecode += OP_NAVIGATE(GetHash("testing")); |
| 277 bytecode += OP_NAVIGATE(GetHash("preference")); |
| 278 bytecode += OP_COMPARE_NODE_HASH(GetHash(kTestPreferenceValue)); |
| 279 bytecode += OP_STORE_BOOL(GetHash("combined_status_mask_bit1"), |
| 280 EncodeBool(true)); |
| 281 bytecode += OP_END_OF_SENTENCE; |
| 282 bytecode += OP_NAVIGATE(GetHash("local_state")); |
| 283 bytecode += OP_NAVIGATE(GetHash("testing")); |
| 284 bytecode += OP_NAVIGATE(GetHash("preference")); |
| 285 bytecode += OP_COMPARE_NODE_HASH(GetHash(kTestPreferenceValue)); |
| 286 bytecode += OP_STORE_BOOL(GetHash("combined_status_mask_bit2"), |
| 287 EncodeBool(true)); |
| 288 bytecode += OP_END_OF_SENTENCE; |
| 289 bytecode += OP_NAVIGATE(GetHash("preferences_iuc")); |
| 290 bytecode += OP_NAVIGATE(GetHash("testing")); |
| 291 bytecode += OP_NAVIGATE(GetHash("preference")); |
| 292 bytecode += OP_COMPARE_NODE_BOOL(EncodeBool(true)); |
| 293 bytecode += OP_STORE_BOOL(GetHash("combined_status_mask_bit3"), |
| 294 EncodeBool(true)); |
| 295 bytecode += OP_END_OF_SENTENCE; |
| 296 bytecode += OP_NAVIGATE(GetHash("local_state_iuc")); |
| 297 bytecode += OP_NAVIGATE(GetHash("testing")); |
| 298 bytecode += OP_NAVIGATE(GetHash("preference")); |
| 299 bytecode += OP_COMPARE_NODE_BOOL(EncodeBool(true)); |
| 300 bytecode += OP_STORE_BOOL(GetHash("combined_status_mask_bit4"), |
| 301 EncodeBool(true)); |
| 302 bytecode += OP_END_OF_SENTENCE; |
| 303 return bytecode; |
| 304 } |
| 305 |
| 306 // Legend for the bitmask returned by the above program. |
| 307 enum CombinedStatusMaskLegendForCheckingPreferences { |
| 308 HAS_EXPECTED_USER_PREFERENCE = 1 << 0, |
| 309 HAS_EXPECTED_LOCAL_STATE_PREFERENCE = 1 << 1, |
| 310 USER_PREFERENCE_IS_USER_CONTROLLED = 1 << 2, |
| 311 LOCAL_STATE_IS_USER_CONTROLLED = 1 << 3, |
| 312 }; |
| 313 |
| 314 // Constructs yet another evaluation program to specifically test that default |
| 315 // and pre-populated search engines are included in the input as expected. We |
| 316 // will re-purpose the output bitmasks to channel out information about the |
| 317 // outcome of the checks. |
| 318 // |
| 319 // More specifically, the output of the program will be as follows: |
| 320 // { |
| 321 // "combined_status_mask_bit1": |
| 322 // (input["default_search_provider.search_url"] == kTestSearchURL) |
| 323 // "combined_status_mask_bit2": input["default_search_provider_iuc"] |
| 324 // "combined_status_mask_bit3": |
| 325 // (input["search_providers.*.search_url"] == kTestSearchURL) |
| 326 // "combined_status_mask_bit4": |
| 327 // (input["search_providers.*.search_url"] == kTestSearchURL2) |
| 328 // } |
| 329 std::string ConstructProgramToCheckSearchEngines() { |
| 330 std::string bytecode; |
| 331 bytecode += OP_NAVIGATE(GetHash("default_search_provider")); |
| 332 bytecode += OP_NAVIGATE(GetHash("search_url")); |
| 333 bytecode += OP_COMPARE_NODE_HASH(GetHash(kTestSearchURL)); |
| 334 bytecode += OP_STORE_BOOL(GetHash("combined_status_mask_bit1"), |
| 335 EncodeBool(true)); |
| 336 bytecode += OP_END_OF_SENTENCE; |
| 337 bytecode += OP_NAVIGATE(GetHash("default_search_provider_iuc")); |
| 338 bytecode += OP_COMPARE_NODE_BOOL(EncodeBool(true)); |
| 339 bytecode += OP_STORE_BOOL(GetHash("combined_status_mask_bit2"), |
| 340 EncodeBool(true)); |
| 341 bytecode += OP_END_OF_SENTENCE; |
| 342 bytecode += OP_NAVIGATE(GetHash("search_providers")); |
| 343 bytecode += OP_NAVIGATE_ANY; |
| 344 bytecode += OP_NAVIGATE(GetHash("search_url")); |
| 345 bytecode += OP_COMPARE_NODE_HASH(GetHash(kTestSearchURL)); |
| 346 bytecode += OP_STORE_BOOL(GetHash("combined_status_mask_bit3"), |
| 347 EncodeBool(true)); |
| 348 bytecode += OP_END_OF_SENTENCE; |
| 349 bytecode += OP_NAVIGATE(GetHash("search_providers")); |
| 350 bytecode += OP_NAVIGATE_ANY; |
| 351 bytecode += OP_NAVIGATE(GetHash("search_url")); |
| 352 bytecode += OP_COMPARE_NODE_HASH(GetHash(kTestSearchURL2)); |
| 353 bytecode += OP_STORE_BOOL(GetHash("combined_status_mask_bit4"), |
| 354 EncodeBool(true)); |
| 355 bytecode += OP_END_OF_SENTENCE; |
| 356 return bytecode; |
| 357 } |
| 358 |
| 359 // Legend for the bitmask returned by the above program. |
| 360 enum CombinedStatusMaskLegendForCheckingSearchEngines { |
| 361 HAS_EXPECTED_DEFAULT_SEARCH_PROVIDER = 1 << 0, |
| 362 DEFAULT_SEARCH_PROVIDER_IS_USER_CONTROLLED = 1 << 1, |
| 363 HAS_EXPECTED_PREPOPULATED_SEARCH_PROVIDER_1 = 1 << 2, |
| 364 HAS_EXPECTED_PREPOPULATED_SEARCH_PROVIDER_2 = 1 << 3, |
| 365 }; |
| 366 |
| 367 // Constructs yet another evaluation program to specifically test that loaded |
| 368 // module digests are included in the input as expected. We will re-purpose the |
| 369 // output bitmasks to channel out information about the outcome of the checks. |
| 370 // |
| 371 // More specifically, the output of the program will be as follows: |
| 372 // { |
| 373 // "combined_status_mask_bit1": |
| 374 // (input["loaded_modules.*"] == kTestModuleDigest) |
| 375 // "combined_status_mask_bit2": |
| 376 // (input["loaded_modules.*"] == kTestModuleDigest2) |
| 377 // } |
| 378 std::string ConstructProgramToCheckLoadedModuleDigests() { |
| 379 std::string bytecode; |
| 380 bytecode += OP_NAVIGATE(GetHash("loaded_modules")); |
| 381 bytecode += OP_NAVIGATE_ANY; |
| 382 bytecode += OP_COMPARE_NODE_HASH(GetHash(kTestModuleDigest)); |
| 383 bytecode += OP_STORE_BOOL(GetHash("combined_status_mask_bit1"), |
| 384 EncodeBool(true)); |
| 385 bytecode += OP_END_OF_SENTENCE; |
| 386 bytecode += OP_NAVIGATE(GetHash("loaded_modules")); |
| 387 bytecode += OP_NAVIGATE_ANY; |
| 388 bytecode += OP_COMPARE_NODE_HASH(GetHash(kTestModuleDigest2)); |
| 389 bytecode += OP_STORE_BOOL(GetHash("combined_status_mask_bit2"), |
| 390 EncodeBool(true)); |
| 391 bytecode += OP_END_OF_SENTENCE; |
| 392 return bytecode; |
| 393 } |
| 394 |
| 395 // Legend for the bitmask returned by the above program. |
| 396 enum CombinedStatusMaskLegendForCheckingLoadedModules { |
| 397 HAS_EXPECTED_MODULE_DIGEST_1 = 1 << 0, |
| 398 HAS_EXPECTED_MODULE_DIGEST_2 = 1 << 1, |
| 399 }; |
| 400 |
145 // Test fixtures ------------------------------------------------------------- | 401 // Test fixtures ------------------------------------------------------------- |
146 | 402 |
147 class AutomaticProfileResetterTestBase : public testing::Test { | 403 class AutomaticProfileResetterTestBase : public testing::Test { |
148 protected: | 404 protected: |
149 explicit AutomaticProfileResetterTestBase( | 405 explicit AutomaticProfileResetterTestBase( |
150 const std::string& experiment_group_name) | 406 const std::string& experiment_group_name) |
151 : local_state_(TestingBrowserProcess::GetGlobal()), | 407 : waiting_task_runner_(new base::TestSimpleTaskRunner), |
| 408 local_state_(TestingBrowserProcess::GetGlobal()), |
| 409 profile_(new TestingProfile()), |
152 experiment_group_name_(experiment_group_name), | 410 experiment_group_name_(experiment_group_name), |
153 mock_delegate_(NULL) { | 411 mock_delegate_(NULL) { |
154 // Make sure the factory is not optimized away, so prefs get registered. | 412 // Make sure the factory is not optimized away, so whatever preferences it |
| 413 // wants to register will actually get registered. |
155 AutomaticProfileResetterFactory::GetInstance(); | 414 AutomaticProfileResetterFactory::GetInstance(); |
| 415 |
| 416 // Register some additional local state preferences for testing purposes. |
| 417 PrefRegistrySimple* local_state_registry = local_state_.Get()->registry(); |
| 418 DCHECK(local_state_registry); |
| 419 local_state_registry->RegisterStringPref(kTestPreferencePath, ""); |
| 420 |
| 421 // Register some additional user preferences for testing purposes. |
| 422 user_prefs::PrefRegistrySyncable* user_prefs_registry = |
| 423 profile_->GetTestingPrefService()->registry(); |
| 424 DCHECK(user_prefs_registry); |
| 425 user_prefs_registry->RegisterStringPref( |
| 426 kTestPreferencePath, |
| 427 "", |
| 428 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
156 } | 429 } |
157 | 430 |
158 virtual void SetUp() OVERRIDE { | 431 virtual void SetUp() OVERRIDE { |
159 profile_.reset(new TestingProfile()); | |
160 field_trials_.reset(new base::FieldTrialList(NULL)); | 432 field_trials_.reset(new base::FieldTrialList(NULL)); |
161 base::FieldTrialList::CreateFieldTrial(kAutomaticProfileResetStudyName, | 433 base::FieldTrialList::CreateFieldTrial(kAutomaticProfileResetStudyName, |
162 experiment_group_name_); | 434 experiment_group_name_); |
163 mock_delegate_ = new testing::StrictMock<MockProfileResetterDelegate>(); | 435 |
164 resetter_.reset(new AutomaticProfileResetter(profile_.get())); | 436 resetter_.reset(new testing::StrictMock<AutomaticProfileResetterUnderTest>( |
| 437 profile_.get())); |
| 438 |
| 439 scoped_ptr<MockProfileResetterDelegate> mock_delegate( |
| 440 new testing::StrictMock<MockProfileResetterDelegate>()); |
| 441 mock_delegate_ = mock_delegate.get(); |
| 442 resetter_->SetDelegateForTesting( |
| 443 mock_delegate.PassAs<AutomaticProfileResetterDelegate>()); |
| 444 resetter_->SetTaskRunnerForWaitingForTesting(waiting_task_runner_); |
165 } | 445 } |
166 | 446 |
167 void SetTestingHashSeed(const std::string& hash_seed) { | 447 void SetTestingHashSeed(const std::string& hash_seed) { |
168 testing_hash_seed_ = hash_seed; | 448 testing_hash_seed_ = hash_seed; |
169 } | 449 } |
170 | 450 |
171 void SetTestingProgram(const std::string& source_code) { | 451 void SetTestingProgram(const std::string& source_code) { |
172 testing_program_ = source_code; | 452 testing_program_ = source_code; |
173 } | 453 } |
174 | 454 |
175 void UnleashResetterAndWait() { | 455 void UnleashResetterAndWait() { |
176 resetter_->Initialize(); | |
177 resetter_->SetDelegateForTesting(mock_delegate_); // Takes ownership. | |
178 resetter_->SetHashSeedForTesting(testing_hash_seed_); | 456 resetter_->SetHashSeedForTesting(testing_hash_seed_); |
179 resetter_->SetProgramForTesting(testing_program_); | 457 resetter_->SetProgramForTesting(testing_program_); |
| 458 |
| 459 resetter_->Activate(); |
| 460 |
| 461 if (waiting_task_runner_->HasPendingTask()) { |
| 462 EXPECT_EQ(base::TimeDelta::FromSeconds(55), |
| 463 waiting_task_runner_->NextPendingTaskDelay()); |
| 464 waiting_task_runner_->RunPendingTasks(); |
| 465 } |
180 base::RunLoop().RunUntilIdle(); | 466 base::RunLoop().RunUntilIdle(); |
181 content::BrowserThread::GetBlockingPool()->FlushForTesting(); | 467 content::BrowserThread::GetBlockingPool()->FlushForTesting(); |
182 base::RunLoop().RunUntilIdle(); | 468 base::RunLoop().RunUntilIdle(); |
183 } | 469 } |
184 | 470 |
185 TestingProfile* profile() { return profile_.get(); } | 471 TestingProfile* profile() { return profile_.get(); } |
| 472 TestingPrefServiceSimple* local_state() { return local_state_.Get(); } |
186 | 473 |
187 MockProfileResetterDelegate& mock_delegate() { return *mock_delegate_; } | 474 MockProfileResetterDelegate& mock_delegate() { return *mock_delegate_; } |
188 AutomaticProfileResetter* resetter() { return resetter_.get(); } | 475 AutomaticProfileResetterUnderTest& resetter() { return *resetter_; } |
189 | 476 |
190 private: | 477 private: |
191 content::TestBrowserThreadBundle thread_bundle_; | 478 content::TestBrowserThreadBundle thread_bundle_; |
| 479 scoped_refptr<base::TestSimpleTaskRunner> waiting_task_runner_; |
192 ScopedTestingLocalState local_state_; | 480 ScopedTestingLocalState local_state_; |
193 scoped_ptr<TestingProfile> profile_; | 481 scoped_ptr<TestingProfile> profile_; |
194 scoped_ptr<base::FieldTrialList> field_trials_; | 482 scoped_ptr<base::FieldTrialList> field_trials_; |
195 std::string experiment_group_name_; | 483 std::string experiment_group_name_; |
196 std::string testing_program_; | 484 std::string testing_program_; |
197 std::string testing_hash_seed_; | 485 std::string testing_hash_seed_; |
198 | 486 |
199 scoped_ptr<AutomaticProfileResetter> resetter_; | 487 scoped_ptr<AutomaticProfileResetterUnderTest> resetter_; |
200 MockProfileResetterDelegate* mock_delegate_; | 488 MockProfileResetterDelegate* mock_delegate_; |
201 | 489 |
202 DISALLOW_COPY_AND_ASSIGN(AutomaticProfileResetterTestBase); | 490 DISALLOW_COPY_AND_ASSIGN(AutomaticProfileResetterTestBase); |
203 }; | 491 }; |
204 | 492 |
205 class AutomaticProfileResetterTest : public AutomaticProfileResetterTestBase { | 493 class AutomaticProfileResetterTest : public AutomaticProfileResetterTestBase { |
206 protected: | 494 protected: |
207 AutomaticProfileResetterTest() | 495 AutomaticProfileResetterTest() |
208 : AutomaticProfileResetterTestBase(kStudyEnabledGroupName) {} | 496 : AutomaticProfileResetterTestBase(kStudyEnabledGroupName) {} |
209 }; | 497 }; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 LocalStateHostedPromptMemento memento_in_local_state(profile()); | 538 LocalStateHostedPromptMemento memento_in_local_state(profile()); |
251 FileHostedPromptMementoSynchronous memento_in_file(profile()); | 539 FileHostedPromptMementoSynchronous memento_in_file(profile()); |
252 | 540 |
253 EXPECT_EQ("", memento_in_prefs.ReadValue()); | 541 EXPECT_EQ("", memento_in_prefs.ReadValue()); |
254 EXPECT_EQ("", memento_in_local_state.ReadValue()); | 542 EXPECT_EQ("", memento_in_local_state.ReadValue()); |
255 EXPECT_EQ("", memento_in_file.ReadValue()); | 543 EXPECT_EQ("", memento_in_file.ReadValue()); |
256 | 544 |
257 SetTestingProgram(ConstructProgram(false, false)); | 545 SetTestingProgram(ConstructProgram(false, false)); |
258 SetTestingHashSeed(kTestHashSeed); | 546 SetTestingHashSeed(kTestHashSeed); |
259 | 547 |
260 EXPECT_CALL(mock_delegate(), ReportStatistics(0x00u, 0x00u)); | 548 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 549 mock_delegate().ExpectCallsToGetterMethods(); |
| 550 EXPECT_CALL(resetter(), ReportStatistics(0x00u, 0x00u)); |
261 | 551 |
262 UnleashResetterAndWait(); | 552 UnleashResetterAndWait(); |
263 | 553 |
264 EXPECT_EQ("", memento_in_prefs.ReadValue()); | 554 EXPECT_EQ("", memento_in_prefs.ReadValue()); |
265 EXPECT_EQ("", memento_in_local_state.ReadValue()); | 555 EXPECT_EQ("", memento_in_local_state.ReadValue()); |
266 EXPECT_EQ("", memento_in_file.ReadValue()); | 556 EXPECT_EQ("", memento_in_file.ReadValue()); |
267 } | 557 } |
268 | 558 |
269 TEST_F(AutomaticProfileResetterTestDryRun, OneConditionSatisfied) { | 559 TEST_F(AutomaticProfileResetterTestDryRun, OneConditionSatisfied) { |
270 PreferenceHostedPromptMemento memento_in_prefs(profile()); | 560 PreferenceHostedPromptMemento memento_in_prefs(profile()); |
271 LocalStateHostedPromptMemento memento_in_local_state(profile()); | 561 LocalStateHostedPromptMemento memento_in_local_state(profile()); |
272 FileHostedPromptMementoSynchronous memento_in_file(profile()); | 562 FileHostedPromptMementoSynchronous memento_in_file(profile()); |
273 | 563 |
274 EXPECT_EQ("", memento_in_prefs.ReadValue()); | 564 EXPECT_EQ("", memento_in_prefs.ReadValue()); |
275 EXPECT_EQ("", memento_in_local_state.ReadValue()); | 565 EXPECT_EQ("", memento_in_local_state.ReadValue()); |
276 EXPECT_EQ("", memento_in_file.ReadValue()); | 566 EXPECT_EQ("", memento_in_file.ReadValue()); |
277 | 567 |
278 SetTestingProgram(ConstructProgram(true, false)); | 568 SetTestingProgram(ConstructProgram(true, false)); |
279 SetTestingHashSeed(kTestHashSeed); | 569 SetTestingHashSeed(kTestHashSeed); |
280 | 570 |
281 EXPECT_CALL(mock_delegate(), ReportStatistics(0x01u, 0x01u)); | 571 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 572 mock_delegate().ExpectCallsToGetterMethods(); |
| 573 EXPECT_CALL(resetter(), ReportStatistics(0x01u, 0x01u)); |
282 | 574 |
283 UnleashResetterAndWait(); | 575 UnleashResetterAndWait(); |
284 | 576 |
285 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); | 577 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); |
286 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); | 578 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); |
287 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); | 579 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); |
288 } | 580 } |
289 | 581 |
290 TEST_F(AutomaticProfileResetterTestDryRun, OtherConditionSatisfied) { | 582 TEST_F(AutomaticProfileResetterTestDryRun, OtherConditionSatisfied) { |
291 PreferenceHostedPromptMemento memento_in_prefs(profile()); | 583 PreferenceHostedPromptMemento memento_in_prefs(profile()); |
292 LocalStateHostedPromptMemento memento_in_local_state(profile()); | 584 LocalStateHostedPromptMemento memento_in_local_state(profile()); |
293 FileHostedPromptMementoSynchronous memento_in_file(profile()); | 585 FileHostedPromptMementoSynchronous memento_in_file(profile()); |
294 | 586 |
295 EXPECT_EQ("", memento_in_prefs.ReadValue()); | 587 EXPECT_EQ("", memento_in_prefs.ReadValue()); |
296 EXPECT_EQ("", memento_in_local_state.ReadValue()); | 588 EXPECT_EQ("", memento_in_local_state.ReadValue()); |
297 EXPECT_EQ("", memento_in_file.ReadValue()); | 589 EXPECT_EQ("", memento_in_file.ReadValue()); |
298 | 590 |
299 SetTestingProgram(ConstructProgram(false, true)); | 591 SetTestingProgram(ConstructProgram(false, true)); |
300 SetTestingHashSeed(kTestHashSeed); | 592 SetTestingHashSeed(kTestHashSeed); |
301 | 593 |
302 EXPECT_CALL(mock_delegate(), ReportStatistics(0x02u, 0x01u)); | 594 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 595 mock_delegate().ExpectCallsToGetterMethods(); |
| 596 EXPECT_CALL(resetter(), ReportStatistics(0x02u, 0x01u)); |
303 | 597 |
304 UnleashResetterAndWait(); | 598 UnleashResetterAndWait(); |
305 | 599 |
306 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); | 600 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); |
307 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); | 601 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); |
308 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); | 602 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); |
309 } | 603 } |
310 | 604 |
311 TEST_F(AutomaticProfileResetterTestDryRun, | 605 TEST_F(AutomaticProfileResetterTestDryRun, |
312 ConditionsSatisfiedAndInvalidMementos) { | 606 ConditionsSatisfiedAndInvalidMementos) { |
313 PreferenceHostedPromptMemento memento_in_prefs(profile()); | 607 PreferenceHostedPromptMemento memento_in_prefs(profile()); |
314 LocalStateHostedPromptMemento memento_in_local_state(profile()); | 608 LocalStateHostedPromptMemento memento_in_local_state(profile()); |
315 FileHostedPromptMementoSynchronous memento_in_file(profile()); | 609 FileHostedPromptMementoSynchronous memento_in_file(profile()); |
316 | 610 |
317 memento_in_prefs.StoreValue(kTestInvalidMementoValue); | 611 memento_in_prefs.StoreValue(kTestInvalidMementoValue); |
318 memento_in_local_state.StoreValue(kTestInvalidMementoValue); | 612 memento_in_local_state.StoreValue(kTestInvalidMementoValue); |
319 memento_in_file.StoreValue(kTestInvalidMementoValue); | 613 memento_in_file.StoreValue(kTestInvalidMementoValue); |
320 | 614 |
321 SetTestingProgram(ConstructProgram(true, true)); | 615 SetTestingProgram(ConstructProgram(true, true)); |
322 SetTestingHashSeed(kTestHashSeed); | 616 SetTestingHashSeed(kTestHashSeed); |
323 | 617 |
324 EXPECT_CALL(mock_delegate(), ReportStatistics(0x03u, 0x01u)); | 618 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 619 mock_delegate().ExpectCallsToGetterMethods(); |
| 620 EXPECT_CALL(resetter(), ReportStatistics(0x03u, 0x01u)); |
325 | 621 |
326 UnleashResetterAndWait(); | 622 UnleashResetterAndWait(); |
327 | 623 |
328 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); | 624 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); |
329 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); | 625 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); |
330 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); | 626 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); |
331 } | 627 } |
332 | 628 |
333 TEST_F(AutomaticProfileResetterTestDryRun, AlreadyHadPrefHostedMemento) { | 629 TEST_F(AutomaticProfileResetterTestDryRun, AlreadyHadPrefHostedMemento) { |
334 PreferenceHostedPromptMemento memento_in_prefs(profile()); | 630 PreferenceHostedPromptMemento memento_in_prefs(profile()); |
335 LocalStateHostedPromptMemento memento_in_local_state(profile()); | 631 LocalStateHostedPromptMemento memento_in_local_state(profile()); |
336 FileHostedPromptMementoSynchronous memento_in_file(profile()); | 632 FileHostedPromptMementoSynchronous memento_in_file(profile()); |
337 | 633 |
338 memento_in_prefs.StoreValue(kTestMementoValue); | 634 memento_in_prefs.StoreValue(kTestMementoValue); |
339 | 635 |
340 SetTestingProgram(ConstructProgram(true, true)); | 636 SetTestingProgram(ConstructProgram(true, true)); |
341 SetTestingHashSeed(kTestHashSeed); | 637 SetTestingHashSeed(kTestHashSeed); |
342 | 638 |
343 EXPECT_CALL(mock_delegate(), ReportStatistics(0x03u, 0x03u)); | 639 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 640 mock_delegate().ExpectCallsToGetterMethods(); |
| 641 EXPECT_CALL(resetter(), ReportStatistics(0x03u, 0x03u)); |
344 | 642 |
345 UnleashResetterAndWait(); | 643 UnleashResetterAndWait(); |
346 | 644 |
347 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); | 645 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); |
348 EXPECT_EQ("", memento_in_local_state.ReadValue()); | 646 EXPECT_EQ("", memento_in_local_state.ReadValue()); |
349 EXPECT_EQ("", memento_in_file.ReadValue()); | 647 EXPECT_EQ("", memento_in_file.ReadValue()); |
350 } | 648 } |
351 | 649 |
352 TEST_F(AutomaticProfileResetterTestDryRun, AlreadyHadLocalStateHostedMemento) { | 650 TEST_F(AutomaticProfileResetterTestDryRun, AlreadyHadLocalStateHostedMemento) { |
353 PreferenceHostedPromptMemento memento_in_prefs(profile()); | 651 PreferenceHostedPromptMemento memento_in_prefs(profile()); |
354 LocalStateHostedPromptMemento memento_in_local_state(profile()); | 652 LocalStateHostedPromptMemento memento_in_local_state(profile()); |
355 FileHostedPromptMementoSynchronous memento_in_file(profile()); | 653 FileHostedPromptMementoSynchronous memento_in_file(profile()); |
356 | 654 |
357 memento_in_local_state.StoreValue(kTestMementoValue); | 655 memento_in_local_state.StoreValue(kTestMementoValue); |
358 | 656 |
359 SetTestingProgram(ConstructProgram(true, true)); | 657 SetTestingProgram(ConstructProgram(true, true)); |
360 SetTestingHashSeed(kTestHashSeed); | 658 SetTestingHashSeed(kTestHashSeed); |
361 | 659 |
362 EXPECT_CALL(mock_delegate(), ReportStatistics(0x03u, 0x05u)); | 660 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 661 mock_delegate().ExpectCallsToGetterMethods(); |
| 662 EXPECT_CALL(resetter(), ReportStatistics(0x03u, 0x05u)); |
363 | 663 |
364 UnleashResetterAndWait(); | 664 UnleashResetterAndWait(); |
365 | 665 |
366 EXPECT_EQ("", memento_in_prefs.ReadValue()); | 666 EXPECT_EQ("", memento_in_prefs.ReadValue()); |
367 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); | 667 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); |
368 EXPECT_EQ("", memento_in_file.ReadValue()); | 668 EXPECT_EQ("", memento_in_file.ReadValue()); |
369 } | 669 } |
370 | 670 |
371 TEST_F(AutomaticProfileResetterTestDryRun, AlreadyHadFileHostedMemento) { | 671 TEST_F(AutomaticProfileResetterTestDryRun, AlreadyHadFileHostedMemento) { |
372 PreferenceHostedPromptMemento memento_in_prefs(profile()); | 672 PreferenceHostedPromptMemento memento_in_prefs(profile()); |
373 LocalStateHostedPromptMemento memento_in_local_state(profile()); | 673 LocalStateHostedPromptMemento memento_in_local_state(profile()); |
374 FileHostedPromptMementoSynchronous memento_in_file(profile()); | 674 FileHostedPromptMementoSynchronous memento_in_file(profile()); |
375 | 675 |
376 memento_in_file.StoreValue(kTestMementoValue); | 676 memento_in_file.StoreValue(kTestMementoValue); |
377 | 677 |
378 SetTestingProgram(ConstructProgram(true, true)); | 678 SetTestingProgram(ConstructProgram(true, true)); |
379 SetTestingHashSeed(kTestHashSeed); | 679 SetTestingHashSeed(kTestHashSeed); |
380 | 680 |
381 EXPECT_CALL(mock_delegate(), ReportStatistics(0x03u, 0x09u)); | 681 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 682 mock_delegate().ExpectCallsToGetterMethods(); |
| 683 EXPECT_CALL(resetter(), ReportStatistics(0x03u, 0x09u)); |
382 | 684 |
383 UnleashResetterAndWait(); | 685 UnleashResetterAndWait(); |
384 | 686 |
385 EXPECT_EQ("", memento_in_prefs.ReadValue()); | 687 EXPECT_EQ("", memento_in_prefs.ReadValue()); |
386 EXPECT_EQ("", memento_in_local_state.ReadValue()); | 688 EXPECT_EQ("", memento_in_local_state.ReadValue()); |
387 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); | 689 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); |
388 } | 690 } |
389 | 691 |
390 TEST_F(AutomaticProfileResetterTestDryRun, DoNothingWhenResourcesAreMissing) { | 692 TEST_F(AutomaticProfileResetterTestDryRun, DoNothingWhenResourcesAreMissing) { |
391 PreferenceHostedPromptMemento memento_in_prefs(profile()); | 693 PreferenceHostedPromptMemento memento_in_prefs(profile()); |
(...skipping 17 matching lines...) Expand all Loading... |
409 LocalStateHostedPromptMemento memento_in_local_state(profile()); | 711 LocalStateHostedPromptMemento memento_in_local_state(profile()); |
410 FileHostedPromptMementoSynchronous memento_in_file(profile()); | 712 FileHostedPromptMementoSynchronous memento_in_file(profile()); |
411 | 713 |
412 EXPECT_EQ("", memento_in_prefs.ReadValue()); | 714 EXPECT_EQ("", memento_in_prefs.ReadValue()); |
413 EXPECT_EQ("", memento_in_local_state.ReadValue()); | 715 EXPECT_EQ("", memento_in_local_state.ReadValue()); |
414 EXPECT_EQ("", memento_in_file.ReadValue()); | 716 EXPECT_EQ("", memento_in_file.ReadValue()); |
415 | 717 |
416 SetTestingProgram(ConstructProgram(false, false)); | 718 SetTestingProgram(ConstructProgram(false, false)); |
417 SetTestingHashSeed(kTestHashSeed); | 719 SetTestingHashSeed(kTestHashSeed); |
418 | 720 |
419 EXPECT_CALL(mock_delegate(), ReportStatistics(0x00u, 0x00u)); | 721 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 722 mock_delegate().ExpectCallsToGetterMethods(); |
| 723 EXPECT_CALL(resetter(), ReportStatistics(0x00u, 0x00u)); |
420 | 724 |
421 UnleashResetterAndWait(); | 725 UnleashResetterAndWait(); |
422 | 726 |
423 EXPECT_EQ("", memento_in_prefs.ReadValue()); | 727 EXPECT_EQ("", memento_in_prefs.ReadValue()); |
424 EXPECT_EQ("", memento_in_local_state.ReadValue()); | 728 EXPECT_EQ("", memento_in_local_state.ReadValue()); |
425 EXPECT_EQ("", memento_in_file.ReadValue()); | 729 EXPECT_EQ("", memento_in_file.ReadValue()); |
426 } | 730 } |
427 | 731 |
428 TEST_F(AutomaticProfileResetterTest, OneConditionSatisfied) { | 732 TEST_F(AutomaticProfileResetterTest, OneConditionSatisfied) { |
429 PreferenceHostedPromptMemento memento_in_prefs(profile()); | 733 PreferenceHostedPromptMemento memento_in_prefs(profile()); |
430 LocalStateHostedPromptMemento memento_in_local_state(profile()); | 734 LocalStateHostedPromptMemento memento_in_local_state(profile()); |
431 FileHostedPromptMementoSynchronous memento_in_file(profile()); | 735 FileHostedPromptMementoSynchronous memento_in_file(profile()); |
432 | 736 |
433 EXPECT_EQ("", memento_in_prefs.ReadValue()); | 737 EXPECT_EQ("", memento_in_prefs.ReadValue()); |
434 EXPECT_EQ("", memento_in_local_state.ReadValue()); | 738 EXPECT_EQ("", memento_in_local_state.ReadValue()); |
435 EXPECT_EQ("", memento_in_file.ReadValue()); | 739 EXPECT_EQ("", memento_in_file.ReadValue()); |
436 | 740 |
437 SetTestingProgram(ConstructProgram(true, false)); | 741 SetTestingProgram(ConstructProgram(true, false)); |
438 SetTestingHashSeed(kTestHashSeed); | 742 SetTestingHashSeed(kTestHashSeed); |
439 | 743 |
| 744 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 745 mock_delegate().ExpectCallsToGetterMethods(); |
440 EXPECT_CALL(mock_delegate(), ShowPrompt()); | 746 EXPECT_CALL(mock_delegate(), ShowPrompt()); |
441 EXPECT_CALL(mock_delegate(), ReportStatistics(0x01u, 0x01u)); | 747 EXPECT_CALL(resetter(), ReportStatistics(0x01u, 0x01u)); |
442 | 748 |
443 UnleashResetterAndWait(); | 749 UnleashResetterAndWait(); |
444 | 750 |
445 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); | 751 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); |
446 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); | 752 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); |
447 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); | 753 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); |
448 } | 754 } |
449 | 755 |
450 TEST_F(AutomaticProfileResetterTest, OtherConditionSatisfied) { | 756 TEST_F(AutomaticProfileResetterTest, OtherConditionSatisfied) { |
451 PreferenceHostedPromptMemento memento_in_prefs(profile()); | 757 PreferenceHostedPromptMemento memento_in_prefs(profile()); |
452 LocalStateHostedPromptMemento memento_in_local_state(profile()); | 758 LocalStateHostedPromptMemento memento_in_local_state(profile()); |
453 FileHostedPromptMementoSynchronous memento_in_file(profile()); | 759 FileHostedPromptMementoSynchronous memento_in_file(profile()); |
454 | 760 |
455 EXPECT_EQ("", memento_in_prefs.ReadValue()); | 761 EXPECT_EQ("", memento_in_prefs.ReadValue()); |
456 EXPECT_EQ("", memento_in_local_state.ReadValue()); | 762 EXPECT_EQ("", memento_in_local_state.ReadValue()); |
457 EXPECT_EQ("", memento_in_file.ReadValue()); | 763 EXPECT_EQ("", memento_in_file.ReadValue()); |
458 | 764 |
459 SetTestingProgram(ConstructProgram(false, true)); | 765 SetTestingProgram(ConstructProgram(false, true)); |
460 SetTestingHashSeed(kTestHashSeed); | 766 SetTestingHashSeed(kTestHashSeed); |
461 | 767 |
| 768 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 769 mock_delegate().ExpectCallsToGetterMethods(); |
462 EXPECT_CALL(mock_delegate(), ShowPrompt()); | 770 EXPECT_CALL(mock_delegate(), ShowPrompt()); |
463 EXPECT_CALL(mock_delegate(), ReportStatistics(0x02u, 0x01u)); | 771 EXPECT_CALL(resetter(), ReportStatistics(0x02u, 0x01u)); |
464 | 772 |
465 UnleashResetterAndWait(); | 773 UnleashResetterAndWait(); |
466 | 774 |
467 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); | 775 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); |
468 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); | 776 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); |
469 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); | 777 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); |
470 } | 778 } |
471 | 779 |
472 TEST_F(AutomaticProfileResetterTest, ConditionsSatisfiedAndInvalidMementos) { | 780 TEST_F(AutomaticProfileResetterTest, ConditionsSatisfiedAndInvalidMementos) { |
473 PreferenceHostedPromptMemento memento_in_prefs(profile()); | 781 PreferenceHostedPromptMemento memento_in_prefs(profile()); |
474 LocalStateHostedPromptMemento memento_in_local_state(profile()); | 782 LocalStateHostedPromptMemento memento_in_local_state(profile()); |
475 FileHostedPromptMementoSynchronous memento_in_file(profile()); | 783 FileHostedPromptMementoSynchronous memento_in_file(profile()); |
476 | 784 |
477 memento_in_prefs.StoreValue(kTestInvalidMementoValue); | 785 memento_in_prefs.StoreValue(kTestInvalidMementoValue); |
478 memento_in_local_state.StoreValue(kTestInvalidMementoValue); | 786 memento_in_local_state.StoreValue(kTestInvalidMementoValue); |
479 memento_in_file.StoreValue(kTestInvalidMementoValue); | 787 memento_in_file.StoreValue(kTestInvalidMementoValue); |
480 | 788 |
481 SetTestingProgram(ConstructProgram(true, true)); | 789 SetTestingProgram(ConstructProgram(true, true)); |
482 SetTestingHashSeed(kTestHashSeed); | 790 SetTestingHashSeed(kTestHashSeed); |
483 | 791 |
| 792 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 793 mock_delegate().ExpectCallsToGetterMethods(); |
484 EXPECT_CALL(mock_delegate(), ShowPrompt()); | 794 EXPECT_CALL(mock_delegate(), ShowPrompt()); |
485 EXPECT_CALL(mock_delegate(), ReportStatistics(0x03u, 0x01u)); | 795 EXPECT_CALL(resetter(), ReportStatistics(0x03u, 0x01u)); |
486 | 796 |
487 UnleashResetterAndWait(); | 797 UnleashResetterAndWait(); |
488 | 798 |
489 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); | 799 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); |
490 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); | 800 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); |
491 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); | 801 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); |
492 } | 802 } |
493 | 803 |
494 TEST_F(AutomaticProfileResetterTest, PrefHostedMementoPreventsPrompt) { | 804 TEST_F(AutomaticProfileResetterTest, PrefHostedMementoPreventsPrompt) { |
495 PreferenceHostedPromptMemento memento_in_prefs(profile()); | 805 PreferenceHostedPromptMemento memento_in_prefs(profile()); |
496 LocalStateHostedPromptMemento memento_in_local_state(profile()); | 806 LocalStateHostedPromptMemento memento_in_local_state(profile()); |
497 FileHostedPromptMementoSynchronous memento_in_file(profile()); | 807 FileHostedPromptMementoSynchronous memento_in_file(profile()); |
498 | 808 |
499 memento_in_prefs.StoreValue(kTestMementoValue); | 809 memento_in_prefs.StoreValue(kTestMementoValue); |
500 | 810 |
501 SetTestingProgram(ConstructProgram(true, true)); | 811 SetTestingProgram(ConstructProgram(true, true)); |
502 SetTestingHashSeed(kTestHashSeed); | 812 SetTestingHashSeed(kTestHashSeed); |
503 | 813 |
504 EXPECT_CALL(mock_delegate(), ReportStatistics(0x03u, 0x03u)); | 814 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 815 mock_delegate().ExpectCallsToGetterMethods(); |
| 816 EXPECT_CALL(resetter(), ReportStatistics(0x03u, 0x03u)); |
505 | 817 |
506 UnleashResetterAndWait(); | 818 UnleashResetterAndWait(); |
507 | 819 |
508 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); | 820 EXPECT_EQ(kTestMementoValue, memento_in_prefs.ReadValue()); |
509 EXPECT_EQ("", memento_in_local_state.ReadValue()); | 821 EXPECT_EQ("", memento_in_local_state.ReadValue()); |
510 EXPECT_EQ("", memento_in_file.ReadValue()); | 822 EXPECT_EQ("", memento_in_file.ReadValue()); |
511 } | 823 } |
512 | 824 |
513 TEST_F(AutomaticProfileResetterTest, LocalStateHostedMementoPreventsPrompt) { | 825 TEST_F(AutomaticProfileResetterTest, LocalStateHostedMementoPreventsPrompt) { |
514 PreferenceHostedPromptMemento memento_in_prefs(profile()); | 826 PreferenceHostedPromptMemento memento_in_prefs(profile()); |
515 LocalStateHostedPromptMemento memento_in_local_state(profile()); | 827 LocalStateHostedPromptMemento memento_in_local_state(profile()); |
516 FileHostedPromptMementoSynchronous memento_in_file(profile()); | 828 FileHostedPromptMementoSynchronous memento_in_file(profile()); |
517 | 829 |
518 memento_in_local_state.StoreValue(kTestMementoValue); | 830 memento_in_local_state.StoreValue(kTestMementoValue); |
519 | 831 |
520 SetTestingProgram(ConstructProgram(true, true)); | 832 SetTestingProgram(ConstructProgram(true, true)); |
521 SetTestingHashSeed(kTestHashSeed); | 833 SetTestingHashSeed(kTestHashSeed); |
522 | 834 |
523 EXPECT_CALL(mock_delegate(), ReportStatistics(0x03u, 0x05u)); | 835 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 836 mock_delegate().ExpectCallsToGetterMethods(); |
| 837 EXPECT_CALL(resetter(), ReportStatistics(0x03u, 0x05u)); |
524 | 838 |
525 UnleashResetterAndWait(); | 839 UnleashResetterAndWait(); |
526 | 840 |
527 EXPECT_EQ("", memento_in_prefs.ReadValue()); | 841 EXPECT_EQ("", memento_in_prefs.ReadValue()); |
528 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); | 842 EXPECT_EQ(kTestMementoValue, memento_in_local_state.ReadValue()); |
529 EXPECT_EQ("", memento_in_file.ReadValue()); | 843 EXPECT_EQ("", memento_in_file.ReadValue()); |
530 } | 844 } |
531 | 845 |
532 TEST_F(AutomaticProfileResetterTest, FileHostedMementoPreventsPrompt) { | 846 TEST_F(AutomaticProfileResetterTest, FileHostedMementoPreventsPrompt) { |
533 PreferenceHostedPromptMemento memento_in_prefs(profile()); | 847 PreferenceHostedPromptMemento memento_in_prefs(profile()); |
534 LocalStateHostedPromptMemento memento_in_local_state(profile()); | 848 LocalStateHostedPromptMemento memento_in_local_state(profile()); |
535 FileHostedPromptMementoSynchronous memento_in_file(profile()); | 849 FileHostedPromptMementoSynchronous memento_in_file(profile()); |
536 | 850 |
537 memento_in_file.StoreValue(kTestMementoValue); | 851 memento_in_file.StoreValue(kTestMementoValue); |
538 | 852 |
539 SetTestingProgram(ConstructProgram(true, true)); | 853 SetTestingProgram(ConstructProgram(true, true)); |
540 SetTestingHashSeed(kTestHashSeed); | 854 SetTestingHashSeed(kTestHashSeed); |
541 | 855 |
542 EXPECT_CALL(mock_delegate(), ReportStatistics(0x03u, 0x09u)); | 856 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 857 mock_delegate().ExpectCallsToGetterMethods(); |
| 858 EXPECT_CALL(resetter(), ReportStatistics(0x03u, 0x09u)); |
543 | 859 |
544 UnleashResetterAndWait(); | 860 UnleashResetterAndWait(); |
545 | 861 |
546 EXPECT_EQ("", memento_in_prefs.ReadValue()); | 862 EXPECT_EQ("", memento_in_prefs.ReadValue()); |
547 EXPECT_EQ("", memento_in_local_state.ReadValue()); | 863 EXPECT_EQ("", memento_in_local_state.ReadValue()); |
548 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); | 864 EXPECT_EQ(kTestMementoValue, memento_in_file.ReadValue()); |
549 } | 865 } |
550 | 866 |
551 TEST_F(AutomaticProfileResetterTest, DoNothingWhenResourcesAreMissing) { | 867 TEST_F(AutomaticProfileResetterTest, DoNothingWhenResourcesAreMissing) { |
552 PreferenceHostedPromptMemento memento_in_prefs(profile()); | 868 PreferenceHostedPromptMemento memento_in_prefs(profile()); |
553 LocalStateHostedPromptMemento memento_in_local_state(profile()); | 869 LocalStateHostedPromptMemento memento_in_local_state(profile()); |
554 FileHostedPromptMementoSynchronous memento_in_file(profile()); | 870 FileHostedPromptMementoSynchronous memento_in_file(profile()); |
555 | 871 |
556 SetTestingProgram(""); | 872 SetTestingProgram(""); |
557 SetTestingHashSeed(""); | 873 SetTestingHashSeed(""); |
558 | 874 |
559 // No calls are expected to the delegate. | 875 // No calls are expected to the delegate. |
560 | 876 |
561 UnleashResetterAndWait(); | 877 UnleashResetterAndWait(); |
562 | 878 |
563 EXPECT_EQ("", memento_in_prefs.ReadValue()); | 879 EXPECT_EQ("", memento_in_prefs.ReadValue()); |
564 EXPECT_EQ("", memento_in_local_state.ReadValue()); | 880 EXPECT_EQ("", memento_in_local_state.ReadValue()); |
565 EXPECT_EQ("", memento_in_file.ReadValue()); | 881 EXPECT_EQ("", memento_in_file.ReadValue()); |
566 } | 882 } |
567 | 883 |
| 884 // Please see comments above ConstructProgramToCheckPreferences() to understand |
| 885 // how the following tests work. |
| 886 |
| 887 TEST_F(AutomaticProfileResetterTest, InputUserPreferencesCorrect) { |
| 888 SetTestingProgram(ConstructProgramToCheckPreferences()); |
| 889 SetTestingHashSeed(kTestHashSeed); |
| 890 |
| 891 PrefService* prefs = profile()->GetPrefs(); |
| 892 prefs->SetString(kTestPreferencePath, kTestPreferenceValue); |
| 893 |
| 894 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 895 mock_delegate().ExpectCallsToGetterMethods(); |
| 896 uint32 expected_mask = |
| 897 HAS_EXPECTED_USER_PREFERENCE | USER_PREFERENCE_IS_USER_CONTROLLED; |
| 898 EXPECT_CALL(resetter(), ReportStatistics(0x00u, expected_mask)); |
| 899 |
| 900 UnleashResetterAndWait(); |
| 901 } |
| 902 |
| 903 TEST_F(AutomaticProfileResetterTest, InputLocalStateCorrect) { |
| 904 SetTestingProgram(ConstructProgramToCheckPreferences()); |
| 905 SetTestingHashSeed(kTestHashSeed); |
| 906 |
| 907 PrefService* prefs = local_state(); |
| 908 prefs->SetString(kTestPreferencePath, kTestPreferenceValue); |
| 909 |
| 910 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 911 mock_delegate().ExpectCallsToGetterMethods(); |
| 912 uint32 expected_mask = |
| 913 HAS_EXPECTED_LOCAL_STATE_PREFERENCE | LOCAL_STATE_IS_USER_CONTROLLED; |
| 914 EXPECT_CALL(resetter(), ReportStatistics(0x00u, expected_mask)); |
| 915 |
| 916 UnleashResetterAndWait(); |
| 917 } |
| 918 |
| 919 TEST_F(AutomaticProfileResetterTest, InputManagedUserPreferencesCorrect) { |
| 920 SetTestingProgram(ConstructProgramToCheckPreferences()); |
| 921 SetTestingHashSeed(kTestHashSeed); |
| 922 |
| 923 TestingPrefServiceSyncable* prefs = profile()->GetTestingPrefService(); |
| 924 prefs->SetManagedPref(kTestPreferencePath, |
| 925 new base::StringValue(kTestPreferenceValue)); |
| 926 |
| 927 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 928 mock_delegate().ExpectCallsToGetterMethods(); |
| 929 uint32 expected_mask = HAS_EXPECTED_USER_PREFERENCE; |
| 930 EXPECT_CALL(resetter(), ReportStatistics(0x00u, expected_mask)); |
| 931 |
| 932 UnleashResetterAndWait(); |
| 933 } |
| 934 |
| 935 TEST_F(AutomaticProfileResetterTest, InputManagedLocalStateCorrect) { |
| 936 SetTestingProgram(ConstructProgramToCheckPreferences()); |
| 937 SetTestingHashSeed(kTestHashSeed); |
| 938 |
| 939 TestingPrefServiceSimple* prefs = local_state(); |
| 940 prefs->SetManagedPref(kTestPreferencePath, |
| 941 new base::StringValue(kTestPreferenceValue)); |
| 942 |
| 943 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 944 mock_delegate().ExpectCallsToGetterMethods(); |
| 945 uint32 expected_mask = HAS_EXPECTED_LOCAL_STATE_PREFERENCE; |
| 946 EXPECT_CALL(resetter(), ReportStatistics(0x00u, expected_mask)); |
| 947 |
| 948 UnleashResetterAndWait(); |
| 949 } |
| 950 |
| 951 // Please see comments above ConstructProgramToCheckSearchEngines() to |
| 952 // understand how the following tests work. |
| 953 |
| 954 TEST_F(AutomaticProfileResetterTest, InputDefaultSearchProviderCorrect) { |
| 955 SetTestingProgram(ConstructProgramToCheckSearchEngines()); |
| 956 SetTestingHashSeed(kTestHashSeed); |
| 957 |
| 958 mock_delegate().emulated_default_search_provider_details().SetString( |
| 959 kSearchURLAttributeKey, kTestSearchURL); |
| 960 |
| 961 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 962 mock_delegate().ExpectCallsToGetterMethods(); |
| 963 uint32 expected_mask = HAS_EXPECTED_DEFAULT_SEARCH_PROVIDER | |
| 964 DEFAULT_SEARCH_PROVIDER_IS_USER_CONTROLLED; |
| 965 EXPECT_CALL(resetter(), ReportStatistics(0x00u, expected_mask)); |
| 966 |
| 967 UnleashResetterAndWait(); |
| 968 } |
| 969 |
| 970 TEST_F(AutomaticProfileResetterTest, InputSearchProviderManagedCorrect) { |
| 971 SetTestingProgram(ConstructProgramToCheckSearchEngines()); |
| 972 SetTestingHashSeed(kTestHashSeed); |
| 973 |
| 974 mock_delegate().emulated_default_search_provider_details().SetString( |
| 975 kSearchURLAttributeKey, kTestSearchURL); |
| 976 mock_delegate().set_emulated_default_search_provider_is_managed(true); |
| 977 |
| 978 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 979 mock_delegate().ExpectCallsToGetterMethods(); |
| 980 uint32 expected_mask = HAS_EXPECTED_DEFAULT_SEARCH_PROVIDER; |
| 981 EXPECT_CALL(resetter(), ReportStatistics(0x00u, expected_mask)); |
| 982 |
| 983 UnleashResetterAndWait(); |
| 984 } |
| 985 |
| 986 TEST_F(AutomaticProfileResetterTest, InputSearchProvidersCorrect) { |
| 987 SetTestingProgram(ConstructProgramToCheckSearchEngines()); |
| 988 SetTestingHashSeed(kTestHashSeed); |
| 989 |
| 990 base::DictionaryValue* search_provider_1 = new base::DictionaryValue; |
| 991 base::DictionaryValue* search_provider_2 = new base::DictionaryValue; |
| 992 search_provider_1->SetString(kSearchURLAttributeKey, kTestSearchURL); |
| 993 search_provider_2->SetString(kSearchURLAttributeKey, kTestSearchURL2); |
| 994 mock_delegate().emulated_search_providers_details().Append(search_provider_1); |
| 995 mock_delegate().emulated_search_providers_details().Append(search_provider_2); |
| 996 |
| 997 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 998 mock_delegate().ExpectCallsToGetterMethods(); |
| 999 uint32 expected_mask = DEFAULT_SEARCH_PROVIDER_IS_USER_CONTROLLED | |
| 1000 HAS_EXPECTED_PREPOPULATED_SEARCH_PROVIDER_1 | |
| 1001 HAS_EXPECTED_PREPOPULATED_SEARCH_PROVIDER_2; |
| 1002 EXPECT_CALL(resetter(), ReportStatistics(0x00u, expected_mask)); |
| 1003 |
| 1004 UnleashResetterAndWait(); |
| 1005 } |
| 1006 |
| 1007 // Please see comments above ConstructProgramToCheckLoadedModuleDigests() to |
| 1008 // understand how the following tests work. |
| 1009 |
| 1010 TEST_F(AutomaticProfileResetterTest, InputModuleDigestsCorrect) { |
| 1011 SetTestingProgram(ConstructProgramToCheckLoadedModuleDigests()); |
| 1012 SetTestingHashSeed(kTestHashSeed); |
| 1013 |
| 1014 mock_delegate().emulated_loaded_module_digests().AppendString( |
| 1015 kTestModuleDigest); |
| 1016 mock_delegate().emulated_loaded_module_digests().AppendString( |
| 1017 kTestModuleDigest2); |
| 1018 |
| 1019 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); |
| 1020 mock_delegate().ExpectCallsToGetterMethods(); |
| 1021 uint32 expected_mask = |
| 1022 HAS_EXPECTED_MODULE_DIGEST_1 | HAS_EXPECTED_MODULE_DIGEST_2; |
| 1023 EXPECT_CALL(resetter(), ReportStatistics(0x00u, expected_mask)); |
| 1024 |
| 1025 UnleashResetterAndWait(); |
| 1026 } |
| 1027 |
568 } // namespace | 1028 } // namespace |
OLD | NEW |