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

Side by Side Diff: base/metrics/field_trial_unittest.cc

Issue 2162053006: Move EXPECT_DCHECK_DEATH from base/task_scheduler and use it in relevant base/ tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge up to r408965 Created 4 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
« no previous file with comments | « base/message_loop/message_pump_libevent_unittest.cc ('k') | base/metrics/histogram_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/metrics/field_trial.h" 5 #include "base/metrics/field_trial.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/build_time.h" 9 #include "base/build_time.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "base/test/gtest_util.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 namespace base { 19 namespace base {
19 20
20 namespace { 21 namespace {
21 22
22 // Default group name used by several tests. 23 // Default group name used by several tests.
23 const char kDefaultGroupName[] = "DefaultGroup"; 24 const char kDefaultGroupName[] = "DefaultGroup";
24 25
25 // Call FieldTrialList::FactoryGetFieldTrial() with a future expiry date. 26 // Call FieldTrialList::FactoryGetFieldTrial() with a future expiry date.
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 FieldTrial::ActiveGroups active_groups; 1114 FieldTrial::ActiveGroups active_groups;
1114 field_trial_list.GetActiveFieldTrialGroups(&active_groups); 1115 field_trial_list.GetActiveFieldTrialGroups(&active_groups);
1115 ASSERT_EQ(2U, active_groups.size()); 1116 ASSERT_EQ(2U, active_groups.size());
1116 EXPECT_EQ("Abc", active_groups[0].trial_name); 1117 EXPECT_EQ("Abc", active_groups[0].trial_name);
1117 EXPECT_EQ("cba", active_groups[0].group_name); 1118 EXPECT_EQ("cba", active_groups[0].group_name);
1118 EXPECT_EQ("Xyz", active_groups[1].trial_name); 1119 EXPECT_EQ("Xyz", active_groups[1].trial_name);
1119 EXPECT_EQ("zyx", active_groups[1].group_name); 1120 EXPECT_EQ("zyx", active_groups[1].group_name);
1120 EXPECT_TRUE(field_trial_list.TrialExists("zzz")); 1121 EXPECT_TRUE(field_trial_list.TrialExists("zzz"));
1121 } 1122 }
1122 1123
1123 #if GTEST_HAS_DEATH_TEST
1124 TEST(FieldTrialDeathTest, OneTimeRandomizedTrialWithoutFieldTrialList) { 1124 TEST(FieldTrialDeathTest, OneTimeRandomizedTrialWithoutFieldTrialList) {
1125 // Trying to instantiate a one-time randomized field trial before the 1125 // Trying to instantiate a one-time randomized field trial before the
1126 // FieldTrialList is created should crash. 1126 // FieldTrialList is created should crash.
1127 EXPECT_DEATH(FieldTrialList::FactoryGetFieldTrial( 1127 EXPECT_DCHECK_DEATH(
1128 "OneTimeRandomizedTrialWithoutFieldTrialList", 100, kDefaultGroupName, 1128 FieldTrialList::FactoryGetFieldTrial(
1129 base::FieldTrialList::kNoExpirationYear, 1, 1, 1129 "OneTimeRandomizedTrialWithoutFieldTrialList", 100, kDefaultGroupName,
1130 base::FieldTrial::ONE_TIME_RANDOMIZED, NULL), ""); 1130 base::FieldTrialList::kNoExpirationYear, 1, 1,
1131 base::FieldTrial::ONE_TIME_RANDOMIZED, NULL),
1132 "");
1131 } 1133 }
1132 #endif
1133 1134
1134 } // namespace base 1135 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop/message_pump_libevent_unittest.cc ('k') | base/metrics/histogram_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698