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

Side by Side Diff: chrome/browser/metrics/variations_service_unittest.cc

Issue 10375043: Variations Service now creates field trials from variations seed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/metrics/proto/study.pb.h" 5 #include "chrome/browser/metrics/proto/study.pb.h"
6 #include "chrome/browser/metrics/variations_service.h" 6 #include "chrome/browser/metrics/variations_service.h"
7 #include "chrome/common/chrome_version_info.h" 7 #include "chrome/common/chrome_version_info.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace { 10 namespace {
11 11
12 // Converts |time| to chrome_variations::Study proto format. 12 // Converts |time| to chrome_variations::Study proto format.
13 int64 TimeToProtoTime(const base::Time& time) { 13 int64 TimeToProtoTime(const base::Time& time) {
14 return (time - base::Time::UnixEpoch()).InMilliseconds(); 14 return (time - base::Time::UnixEpoch()).InSeconds();
15 } 15 }
16 16
17 } // namespace 17 } // namespace
18 18
19 19
20 TEST(VariationsServiceTest, CheckStudyChannel) { 20 TEST(VariationsServiceTest, CheckStudyChannel) {
21 const chrome::VersionInfo::Channel channels[] = { 21 const chrome::VersionInfo::Channel channels[] = {
22 chrome::VersionInfo::CHANNEL_CANARY, 22 chrome::VersionInfo::CHANNEL_CANARY,
23 chrome::VersionInfo::CHANNEL_DEV, 23 chrome::VersionInfo::CHANNEL_DEV,
24 chrome::VersionInfo::CHANNEL_BETA, 24 chrome::VersionInfo::CHANNEL_BETA,
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(expiry_test_cases); ++j) { 202 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(expiry_test_cases); ++j) {
203 study.set_start_date(TimeToProtoTime(start_test_cases[i].start_date)); 203 study.set_start_date(TimeToProtoTime(start_test_cases[i].start_date));
204 study.set_expiry_date(TimeToProtoTime(expiry_test_cases[j].expiry_date)); 204 study.set_expiry_date(TimeToProtoTime(expiry_test_cases[j].expiry_date));
205 const bool expected = start_test_cases[i].expected_result && 205 const bool expected = start_test_cases[i].expected_result &&
206 expiry_test_cases[j].expected_result; 206 expiry_test_cases[j].expected_result;
207 const bool result = VariationsService::CheckStudyDate(study, now); 207 const bool result = VariationsService::CheckStudyDate(study, now);
208 EXPECT_EQ(expected, result) << "Case " << i << "," << j << " failed!"; 208 EXPECT_EQ(expected, result) << "Case " << i << "," << j << " failed!";
209 } 209 }
210 } 210 }
211 } 211 }
OLDNEW
« chrome/browser/metrics/variations_service.cc ('K') | « chrome/browser/metrics/variations_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698