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

Unified Diff: content/child/shared_memory_data_consumer_handle_unittest.cc

Issue 2391513002: Remove lock from SharedMemoryDataConsumerHandle::Context destructor (Closed)
Patch Set: fix 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/shared_memory_data_consumer_handle.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/shared_memory_data_consumer_handle_unittest.cc
diff --git a/content/child/shared_memory_data_consumer_handle_unittest.cc b/content/child/shared_memory_data_consumer_handle_unittest.cc
index 7acbb9a52335180ebac2b51c6b4d040dd771195d..e9ebe02371fb150979d3af3531060e7a6ed05362 100644
--- a/content/child/shared_memory_data_consumer_handle_unittest.cc
+++ b/content/child/shared_memory_data_consumer_handle_unittest.cc
@@ -19,6 +19,7 @@
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
+#include "base/strings/string_split.h"
#include "base/task_runner.h"
#include "base/threading/thread.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -974,15 +975,22 @@ TEST(SharedMemoryDataConsumerHandleBackpressureTest, CloseAndReset) {
reader.reset();
logger->Add("4");
- EXPECT_EQ(
- "1\n"
- "2\n"
- "3\n"
- "data1 is destructed.\n"
- "data2 is destructed.\n"
- "data3 is destructed.\n"
- "4\n",
- logger->log());
+ std::vector<std::string> log = base::SplitString(
+ logger->log(), "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
+
+ ASSERT_EQ(8u, log.size());
+ EXPECT_EQ("1", log[0]);
+ EXPECT_EQ("2", log[1]);
+ EXPECT_EQ("3", log[2]);
+ EXPECT_EQ("4", log[6]);
+ EXPECT_EQ("", log[7]);
+
+ // The destruction order doesn't matter in this case.
+ std::vector<std::string> destruction_entries = {log[3], log[4], log[5]};
+ std::sort(destruction_entries.begin(), destruction_entries.end());
+ EXPECT_EQ(destruction_entries[0], "data1 is destructed.");
+ EXPECT_EQ(destruction_entries[1], "data2 is destructed.");
+ EXPECT_EQ(destruction_entries[2], "data3 is destructed.");
}
TEST(SharedMemoryDataConsumerHandleWithoutBackpressureTest, AddData) {
« no previous file with comments | « content/child/shared_memory_data_consumer_handle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698