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

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

Issue 2862123002: Pass the GUID for the SharedMemoryHandle used by base::FieldTrialList. (Closed)
Patch Set: Pass string piece by value. Created 3 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
« no previous file with comments | « base/metrics/field_trial.cc ('k') | content/browser/child_process_launcher_helper_posix.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/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/build_time.h" 10 #include "base/build_time.h"
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 EXPECT_EQ(group_name, shm_group_name); 1362 EXPECT_EQ(group_name, shm_group_name);
1363 1363
1364 // Check that the params match. 1364 // Check that the params match.
1365 std::map<std::string, std::string> shm_params; 1365 std::map<std::string, std::string> shm_params;
1366 entry->GetParams(&shm_params); 1366 entry->GetParams(&shm_params);
1367 EXPECT_EQ(2u, shm_params.size()); 1367 EXPECT_EQ(2u, shm_params.size());
1368 EXPECT_EQ("value1", shm_params["key1"]); 1368 EXPECT_EQ("value1", shm_params["key1"]);
1369 EXPECT_EQ("value2", shm_params["key2"]); 1369 EXPECT_EQ("value2", shm_params["key2"]);
1370 } 1370 }
1371 1371
1372 #if !defined(OS_NACL)
1373 TEST(FieldTrialListTest, SerializeSharedMemoryHandleMetadata) {
1374 std::unique_ptr<base::SharedMemory> shm(new SharedMemory());
1375 shm->CreateAndMapAnonymous(4 << 10);
1376
1377 std::string serialized =
1378 FieldTrialList::SerializeSharedMemoryHandleMetadata(shm->handle());
1379 #if defined(OS_WIN)
1380 SharedMemoryHandle deserialized =
1381 FieldTrialList::DeserializeSharedMemoryHandleMetadata(serialized);
1382 #else
1383 SharedMemoryHandle deserialized =
1384 FieldTrialList::DeserializeSharedMemoryHandleMetadata(-1, serialized);
1385 #endif
1386 EXPECT_EQ(deserialized.GetGUID(), shm->handle().GetGUID());
1387 EXPECT_FALSE(deserialized.GetGUID().is_empty());
1388 }
1389 #endif // !defined(OS_NACL)
1390
1372 } // namespace base 1391 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/field_trial.cc ('k') | content/browser/child_process_launcher_helper_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698