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