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

Side by Side Diff: Source/platform/SharedBufferTest.cpp

Issue 1182703002: Fix unit test style in Source/platform/, part 1. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 21 matching lines...) Expand all
32 #include "platform/SharedBuffer.h" 32 #include "platform/SharedBuffer.h"
33 33
34 #include "platform/TestingPlatformSupport.h" 34 #include "platform/TestingPlatformSupport.h"
35 #include "public/platform/WebDiscardableMemory.h" 35 #include "public/platform/WebDiscardableMemory.h"
36 #include "wtf/RefPtr.h" 36 #include "wtf/RefPtr.h"
37 #include "wtf/Vector.h" 37 #include "wtf/Vector.h"
38 #include <algorithm> 38 #include <algorithm>
39 #include <cstdlib> 39 #include <cstdlib>
40 #include <gtest/gtest.h> 40 #include <gtest/gtest.h>
41 41
42 using namespace blink; 42 namespace blink {
43
44 namespace {
45 43
46 TEST(SharedBufferTest, getAsBytes) 44 TEST(SharedBufferTest, getAsBytes)
47 { 45 {
48 char testData0[] = "Hello"; 46 char testData0[] = "Hello";
49 char testData1[] = "World"; 47 char testData1[] = "World";
50 char testData2[] = "Goodbye"; 48 char testData2[] = "Goodbye";
51 49
52 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(testData0, strlen(t estData0)); 50 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(testData0, strlen(t estData0));
53 sharedBuffer->append(testData1, strlen(testData1)); 51 sharedBuffer->append(testData1, strlen(testData1));
54 sharedBuffer->append(testData2, strlen(testData2)); 52 sharedBuffer->append(testData2, strlen(testData2));
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 ASSERT_EQ(0, memcmp(data, testData.data(), length)); 146 ASSERT_EQ(0, memcmp(data, testData.data(), length));
149 147
150 // Do another append + merge the segments again. 148 // Do another append + merge the segments again.
151 size_t previousTestDataSize = testData.size(); 149 size_t previousTestDataSize = testData.size();
152 testData.resize(2 * previousTestDataSize); 150 testData.resize(2 * previousTestDataSize);
153 std::generate(testData.begin() + previousTestDataSize, testData.end(), &std: :rand); 151 std::generate(testData.begin() + previousTestDataSize, testData.end(), &std: :rand);
154 sharedBuffer->append(testData.data() + previousTestDataSize, previousTestDat aSize); 152 sharedBuffer->append(testData.data() + previousTestDataSize, previousTestDat aSize);
155 ASSERT_EQ(0, memcmp(data, testData.data(), length)); 153 ASSERT_EQ(0, memcmp(data, testData.data(), length));
156 } 154 }
157 155
158 } // namespace 156 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698