OLD | NEW |
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 Loading... |
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 |
OLD | NEW |