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

Unified Diff: base/metrics/field_trial_unittest.cc

Issue 2365273004: Initial implementation for sharing field trial state (win) (Closed)
Patch Set: rebase + gclient sync Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/field_trial.cc ('k') | components/nacl/browser/nacl_broker_host_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/field_trial_unittest.cc
diff --git a/base/metrics/field_trial_unittest.cc b/base/metrics/field_trial_unittest.cc
index caa00e814cbf9dcfc3d918bf3b8ea8d20b147a6e..bb45bd717e02f3e527efd775bf60ba821c034801 100644
--- a/base/metrics/field_trial_unittest.cc
+++ b/base/metrics/field_trial_unittest.cc
@@ -6,14 +6,18 @@
#include <stddef.h>
+#include "base/base_switches.h"
#include "base/build_time.h"
+#include "base/feature_list.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/rand_util.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/test/gtest_util.h"
+#include "base/test/mock_entropy_provider.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
@@ -1132,4 +1136,19 @@ TEST(FieldTrialDeathTest, OneTimeRandomizedTrialWithoutFieldTrialList) {
"");
}
+TEST(FieldTrialListTest, TestCopyFieldTrialStateToFlags) {
+ base::FieldTrialList field_trial_list(
+ base::MakeUnique<base::MockEntropyProvider>());
+ base::FieldTrialList::CreateFieldTrial("Trial1", "Group1");
+ base::FilePath test_file_path = base::FilePath(FILE_PATH_LITERAL("Program"));
+ base::CommandLine cmd_line = base::CommandLine(test_file_path);
+
+ std::unique_ptr<base::SharedMemory> field_trial_state =
+ base::FieldTrialList::CopyFieldTrialStateToFlags("field-trial-handle",
+ &cmd_line);
+
+ EXPECT_TRUE(field_trial_state.get() == nullptr);
+ EXPECT_TRUE(cmd_line.HasSwitch(switches::kForceFieldTrials));
+}
+
} // namespace base
« no previous file with comments | « base/metrics/field_trial.cc ('k') | components/nacl/browser/nacl_broker_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698