Chromium Code Reviews| Index: content/browser/browser_child_process_host_impl_unittest.cc |
| diff --git a/content/browser/browser_child_process_host_impl_unittest.cc b/content/browser/browser_child_process_host_impl_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..911c08405faaeb2c619a97cf97e3efa852a642ce |
| --- /dev/null |
| +++ b/content/browser/browser_child_process_host_impl_unittest.cc |
| @@ -0,0 +1,44 @@ |
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
|
Alexei Svitkine (slow)
2016/10/03 15:28:05
No (c) for new code.
lawrencewu
2016/10/03 21:36:11
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include <string> |
| + |
| +#include "base/files/file_path.h" |
| +#include "base/memory/ptr_util.h" |
| +#include "base/metrics/field_trial.h" |
| +#include "base/test/mock_entropy_provider.h" |
| +#include "content/browser/browser_child_process_host_impl.h" |
| +#include "content/public/browser/browser_child_process_host_delegate.h" |
| +#include "content/public/common/service_names.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace content { |
| + |
| +class BrowserChildProcessHostImplTest : public testing::Test { |
| +}; |
|
Alexei Svitkine (slow)
2016/10/03 15:28:05
If your test code has no use of the harness class,
lawrencewu
2016/10/03 21:36:11
Done.
|
| + |
| +TEST_F(BrowserChildProcessHostImplTest, TestCopyFeatureAndFieldTrialFlags) { |
| + 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 = new base::CommandLine(test_file_path); |
| + |
| +#if defined(OS_WIN) |
| + base::SharedMemory* field_trial_state = new base::SharedMemory(); |
| + BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags( |
| + cmd_line, field_trial_state); |
| + std::string field_trial_state_string( |
| + static_cast<char*>(field_trial_state->memory())); |
| + |
| + EXPECT_EQ("Trial1/Group1/", field_trial_state_string); |
| + EXPECT_TRUE(cmd_line->HasSwitch("field_trial_handle")); |
| + EXPECT_TRUE(cmd_line->HasSwitch("field_trial_length")); |
| +#else |
| + BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(cmd_line); |
| + EXPECT_TRUE(cmd_line->HasSwitch("force_fieldtrials")); |
| +#endif |
| +} |
| + |
| +} // content |
|
Alexei Svitkine (slow)
2016/10/03 15:28:05
This should be "// namespace content". Also, put 2
lawrencewu
2016/10/03 21:36:11
Done.
|