Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(762)

Side by Side Diff: chrome/browser/profile_resetter/automatic_profile_resetter_unittest.cc

Issue 421663003: Move variations component code to variations namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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" 5 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 // Register some additional user preferences for testing purposes. 509 // Register some additional user preferences for testing purposes.
510 user_prefs::PrefRegistrySyncable* user_prefs_registry = 510 user_prefs::PrefRegistrySyncable* user_prefs_registry =
511 profile_->GetTestingPrefService()->registry(); 511 profile_->GetTestingPrefService()->registry();
512 DCHECK(user_prefs_registry); 512 DCHECK(user_prefs_registry);
513 user_prefs_registry->RegisterStringPref( 513 user_prefs_registry->RegisterStringPref(
514 kTestPreferencePath, std::string(), 514 kTestPreferencePath, std::string(),
515 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 515 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
516 } 516 }
517 517
518 virtual void SetUp() OVERRIDE { 518 virtual void SetUp() OVERRIDE {
519 chrome_variations::testing::ClearAllVariationParams(); 519 variations::testing::ClearAllVariationParams();
520 base::FieldTrialList::CreateFieldTrial(kAutomaticProfileResetStudyName, 520 base::FieldTrialList::CreateFieldTrial(kAutomaticProfileResetStudyName,
521 experiment_group_name_); 521 experiment_group_name_);
522 resetter_.reset( 522 resetter_.reset(
523 new testing::StrictMock<AutomaticProfileResetterUnderTest>(profile())); 523 new testing::StrictMock<AutomaticProfileResetterUnderTest>(profile()));
524 mock_delegate_owned_.reset( 524 mock_delegate_owned_.reset(
525 new testing::StrictMock<MockProfileResetterDelegate>()); 525 new testing::StrictMock<MockProfileResetterDelegate>());
526 mock_delegate_ = mock_delegate_owned_.get(); 526 mock_delegate_ = mock_delegate_owned_.get();
527 527
528 ExpectAllMementoValuesEqualTo(std::string()); 528 ExpectAllMementoValuesEqualTo(std::string());
529 } 529 }
(...skipping 14 matching lines...) Expand all
544 EXPECT_EQ(value, memento_in_prefs_->ReadValue()); 544 EXPECT_EQ(value, memento_in_prefs_->ReadValue());
545 EXPECT_EQ(value, memento_in_local_state_->ReadValue()); 545 EXPECT_EQ(value, memento_in_local_state_->ReadValue());
546 EXPECT_EQ(value, memento_in_file_->ReadValue()); 546 EXPECT_EQ(value, memento_in_file_->ReadValue());
547 } 547 }
548 548
549 void UnleashResetterAndWait() { 549 void UnleashResetterAndWait() {
550 if (inject_data_through_variation_params_) { 550 if (inject_data_through_variation_params_) {
551 std::map<std::string, std::string> variation_params; 551 std::map<std::string, std::string> variation_params;
552 variation_params["program"] = testing_program_; 552 variation_params["program"] = testing_program_;
553 variation_params["hash_seed"] = testing_hash_seed_; 553 variation_params["hash_seed"] = testing_hash_seed_;
554 ASSERT_TRUE(chrome_variations::AssociateVariationParams( 554 ASSERT_TRUE(variations::AssociateVariationParams(
555 kAutomaticProfileResetStudyName, 555 kAutomaticProfileResetStudyName,
556 experiment_group_name_, 556 experiment_group_name_,
557 variation_params)); 557 variation_params));
558 } 558 }
559 resetter_->Initialize(); 559 resetter_->Initialize();
560 resetter_->SetDelegateForTesting( 560 resetter_->SetDelegateForTesting(
561 mock_delegate_owned_.PassAs<AutomaticProfileResetterDelegate>()); 561 mock_delegate_owned_.PassAs<AutomaticProfileResetterDelegate>());
562 resetter_->SetTaskRunnerForWaitingForTesting(waiting_task_runner_); 562 resetter_->SetTaskRunnerForWaitingForTesting(waiting_task_runner_);
563 if (!inject_data_through_variation_params_) { 563 if (!inject_data_through_variation_params_) {
564 resetter_->SetProgramForTesting(testing_program_); 564 resetter_->SetProgramForTesting(testing_program_);
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 mock_delegate().ExpectCallsToDependenciesSetUpMethods(); 1371 mock_delegate().ExpectCallsToDependenciesSetUpMethods();
1372 mock_delegate().ExpectCallsToGetterMethods(); 1372 mock_delegate().ExpectCallsToGetterMethods();
1373 uint32 expected_mask = 1373 uint32 expected_mask =
1374 HAS_EXPECTED_MODULE_DIGEST_1 | HAS_EXPECTED_MODULE_DIGEST_2; 1374 HAS_EXPECTED_MODULE_DIGEST_1 | HAS_EXPECTED_MODULE_DIGEST_2;
1375 EXPECT_CALL(resetter(), ReportStatistics(0x00u, expected_mask)); 1375 EXPECT_CALL(resetter(), ReportStatistics(0x00u, expected_mask));
1376 1376
1377 UnleashResetterAndWait(); 1377 UnleashResetterAndWait();
1378 } 1378 }
1379 1379
1380 } // namespace 1380 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/profile_resetter/automatic_profile_resetter.cc ('k') | chrome/common/variations/experiment_labels.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698