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

Side by Side Diff: base/memory/discardable_shared_memory_unittest.cc

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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/memory/discardable_shared_memory.cc ('k') | base/message_loop/message_loop_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/memory/discardable_shared_memory.h" 6 #include "base/memory/discardable_shared_memory.h"
7 #include "base/process/process_metrics.h" 7 #include "base/process/process_metrics.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace base { 10 namespace base {
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 280
281 // The failed purge attempt should have updated usage time to the correct 281 // The failed purge attempt should have updated usage time to the correct
282 // value. 282 // value.
283 EXPECT_EQ(Time::FromDoubleT(5), memory1.last_known_usage()); 283 EXPECT_EQ(Time::FromDoubleT(5), memory1.last_known_usage());
284 284
285 // Purge should now succeed. 285 // Purge should now succeed.
286 rv = memory1.Purge(Time::FromDoubleT(7)); 286 rv = memory1.Purge(Time::FromDoubleT(7));
287 EXPECT_TRUE(rv); 287 EXPECT_TRUE(rv);
288 } 288 }
289 289
290 TEST(DiscardableSharedMemoryTest, MappedSize) {
291 const uint32 kDataSize = 1024;
292
293 TestDiscardableSharedMemory memory;
294 bool rv = memory.CreateAndMap(kDataSize);
295 ASSERT_TRUE(rv);
296
297 EXPECT_LE(kDataSize, memory.mapped_size());
298
299 // Mapped size should be 0 after memory segment has been closed.
300 memory.Close();
301 EXPECT_EQ(0u, memory.mapped_size());
302 }
303
290 } // namespace 304 } // namespace
291 } // namespace base 305 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/discardable_shared_memory.cc ('k') | base/message_loop/message_loop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698