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

Side by Side Diff: components/variations/variations_seed_processor_unittest.cc

Issue 100543005: Update all users of base::Version to explicitly specify the namespace, and clean up the header. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: someday it will work Created 6 years, 12 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 "components/variations/variations_seed_processor.h" 5 #include "components/variations/variations_seed_processor.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 { "1.*", "2.3.4", false }, 392 { "1.*", "2.3.4", false },
393 }; 393 };
394 394
395 Study_Filter filter; 395 Study_Filter filter;
396 396
397 // Min/max version not set should result in true. 397 // Min/max version not set should result in true.
398 EXPECT_TRUE(seed_processor.CheckStudyVersion(filter, base::Version("1.2.3"))); 398 EXPECT_TRUE(seed_processor.CheckStudyVersion(filter, base::Version("1.2.3")));
399 399
400 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(min_test_cases); ++i) { 400 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(min_test_cases); ++i) {
401 filter.set_min_version(min_test_cases[i].min_version); 401 filter.set_min_version(min_test_cases[i].min_version);
402 const bool result = 402 const bool result = seed_processor.CheckStudyVersion(
403 seed_processor.CheckStudyVersion(filter, 403 filter, base::Version(min_test_cases[i].version));
404 Version(min_test_cases[i].version));
405 EXPECT_EQ(min_test_cases[i].expected_result, result) << 404 EXPECT_EQ(min_test_cases[i].expected_result, result) <<
406 "Min. version case " << i << " failed!"; 405 "Min. version case " << i << " failed!";
407 } 406 }
408 filter.clear_min_version(); 407 filter.clear_min_version();
409 408
410 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(max_test_cases); ++i) { 409 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(max_test_cases); ++i) {
411 filter.set_max_version(max_test_cases[i].max_version); 410 filter.set_max_version(max_test_cases[i].max_version);
412 const bool result = 411 const bool result = seed_processor.CheckStudyVersion(
413 seed_processor.CheckStudyVersion(filter, 412 filter, base::Version(max_test_cases[i].version));
414 Version(max_test_cases[i].version));
415 EXPECT_EQ(max_test_cases[i].expected_result, result) << 413 EXPECT_EQ(max_test_cases[i].expected_result, result) <<
416 "Max version case " << i << " failed!"; 414 "Max version case " << i << " failed!";
417 } 415 }
418 416
419 // Check intersection semantics. 417 // Check intersection semantics.
420 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(min_test_cases); ++i) { 418 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(min_test_cases); ++i) {
421 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(max_test_cases); ++j) { 419 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(max_test_cases); ++j) {
422 filter.set_min_version(min_test_cases[i].min_version); 420 filter.set_min_version(min_test_cases[i].min_version);
423 filter.set_max_version(max_test_cases[j].max_version); 421 filter.set_max_version(max_test_cases[j].max_version);
424 422
425 if (!min_test_cases[i].expected_result) { 423 if (!min_test_cases[i].expected_result) {
426 const bool result = 424 const bool result = seed_processor.CheckStudyVersion(
427 seed_processor.CheckStudyVersion( 425 filter, base::Version(min_test_cases[i].version));
428 filter, Version(min_test_cases[i].version));
429 EXPECT_FALSE(result) << "Case " << i << "," << j << " failed!"; 426 EXPECT_FALSE(result) << "Case " << i << "," << j << " failed!";
430 } 427 }
431 428
432 if (!max_test_cases[j].expected_result) { 429 if (!max_test_cases[j].expected_result) {
433 const bool result = 430 const bool result = seed_processor.CheckStudyVersion(
434 seed_processor.CheckStudyVersion( 431 filter, base::Version(max_test_cases[j].version));
435 filter, Version(max_test_cases[j].version));
436 EXPECT_FALSE(result) << "Case " << i << "," << j << " failed!"; 432 EXPECT_FALSE(result) << "Case " << i << "," << j << " failed!";
437 } 433 }
438 } 434 }
439 } 435 }
440 } 436 }
441 437
442 TEST_F(VariationsSeedProcessorTest, FilterAndValidateStudies) { 438 TEST_F(VariationsSeedProcessorTest, FilterAndValidateStudies) {
443 const std::string kTrial1Name = "A"; 439 const std::string kTrial1Name = "A";
444 const std::string kGroup1Name = "Group1"; 440 const std::string kGroup1Name = "Group1";
445 const std::string kTrial3Name = "B"; 441 const std::string kTrial3Name = "B";
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 EXPECT_EQ("BB", base::FieldTrialList::FindFullName("B")); 732 EXPECT_EQ("BB", base::FieldTrialList::FindFullName("B"));
737 EXPECT_EQ("CC", base::FieldTrialList::FindFullName("C")); 733 EXPECT_EQ("CC", base::FieldTrialList::FindFullName("C"));
738 734
739 // Now, all studies should be active. 735 // Now, all studies should be active.
740 EXPECT_TRUE(IsFieldTrialActive("A")); 736 EXPECT_TRUE(IsFieldTrialActive("A"));
741 EXPECT_TRUE(IsFieldTrialActive("B")); 737 EXPECT_TRUE(IsFieldTrialActive("B"));
742 EXPECT_TRUE(IsFieldTrialActive("C")); 738 EXPECT_TRUE(IsFieldTrialActive("C"));
743 } 739 }
744 740
745 } // namespace chrome_variations 741 } // namespace chrome_variations
OLDNEW
« no previous file with comments | « components/variations/processed_study.cc ('k') | content/browser/gpu/gpu_data_manager_impl_private.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698