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 "net/socket/socket_test_util.h" | 5 #include "net/socket/socket_test_util.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "testing/platform_test.h" | 10 #include "testing/platform_test.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 //----------------------------------------------------------------------------- | 13 //----------------------------------------------------------------------------- |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 static const char kMsg1[] = "\0hello!\xff"; | 17 static const char kMsg1[] = "\0hello!\xff"; |
18 static const int kLen1 = arraysize(kMsg1); | 18 static const int kLen1 = arraysize(kMsg1); |
19 static const char kMsg2[] = "\012345678\0"; | 19 static const char kMsg2[] = "\0a2345678\0"; |
20 static const int kLen2 = arraysize(kMsg2); | 20 static const int kLen2 = arraysize(kMsg2); |
21 static const char kMsg3[] = "bye!"; | 21 static const char kMsg3[] = "bye!"; |
22 static const int kLen3 = arraysize(kMsg3); | 22 static const int kLen3 = arraysize(kMsg3); |
23 | 23 |
24 } // anonymous namespace | 24 } // anonymous namespace |
25 | 25 |
26 namespace net { | 26 namespace net { |
27 | 27 |
28 class DeterministicSocketDataTest : public PlatformTest { | 28 class DeterministicSocketDataTest : public PlatformTest { |
29 public: | 29 public: |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 data_->StopAfter(1); | 611 data_->StopAfter(1); |
612 AssertSyncWriteEquals(kMsg3, kLen3); | 612 AssertSyncWriteEquals(kMsg3, kLen3); |
613 | 613 |
614 data_->RunFor(1); | 614 data_->RunFor(1); |
615 ASSERT_TRUE(read_callback_.have_result()); | 615 ASSERT_TRUE(read_callback_.have_result()); |
616 ASSERT_EQ(kLen2, read_callback_.WaitForResult()); | 616 ASSERT_EQ(kLen2, read_callback_.WaitForResult()); |
617 AssertReadBufferEquals(kMsg2, kLen2); | 617 AssertReadBufferEquals(kMsg2, kLen2); |
618 } | 618 } |
619 | 619 |
620 } // namespace net | 620 } // namespace net |
OLD | NEW |