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

Side by Side Diff: content/browser/browser_child_process_host_impl_unittest.cc

Issue 2365273004: Initial implementation for sharing field trial state (win) (Closed)
Patch Set: Fix unit test and remove macro 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <string>
6
7 #include "base/base_switches.h"
8 #include "base/files/file_path.h"
9 #include "base/memory/ptr_util.h"
10 #include "base/metrics/field_trial.h"
11 #include "base/test/mock_entropy_provider.h"
12 #include "content/browser/browser_child_process_host_impl.h"
Alexei Svitkine (slow) 2016/10/04 18:49:35 This should be the first include.
lawrencewu 2016/10/05 20:57:56 Done.
13 #include "content/public/browser/browser_child_process_host_delegate.h"
14 #include "content/public/common/content_switches.h"
15 #include "content/public/common/service_names.h"
16 #include "testing/gtest/include/gtest/gtest.h"
17
18 namespace content {
19
20 TEST(BrowserChildProcessHostImplTest, TestCopyFeatureAndFieldTrialFlags) {
21 base::FieldTrialList field_trial_list(
22 base::MakeUnique<base::MockEntropyProvider>());
23 base::FieldTrialList::CreateFieldTrial("Trial1", "Group1");
24 base::FilePath test_file_path = base::FilePath(FILE_PATH_LITERAL("Program"));
25 base::CommandLine* cmd_line = new base::CommandLine(test_file_path);
26
27 #if defined(OS_WIN)
28 base::SharedMemory* field_trial_state = new base::SharedMemory();
29 BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(cmd_line,
30 field_trial_state);
31 std::string field_trial_state_string(
32 static_cast<char*>(field_trial_state->memory()));
33
34 EXPECT_EQ("Trial1/Group1/", field_trial_state_string);
35 EXPECT_TRUE(cmd_line->HasSwitch(switches::kFieldTrialHandle));
36 #else
37 BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(cmd_line);
38 EXPECT_TRUE(cmd_line->HasSwitch(switches::kForceFieldTrials));
39 #endif
40 }
41
42 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_child_process_host_impl.cc ('k') | content/browser/child_process_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698