| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/platform_test.h" | |
| 8 #include "net/base/file_stream.h" | 7 #include "net/base/file_stream.h" |
| 9 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 10 #include "net/base/test_completion_callback.h" | 9 #include "net/base/test_completion_callback.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "testing/platform_test.h" |
| 12 | 12 |
| 13 static const char kTestData[] = "0123456789"; | 13 static const char kTestData[] = "0123456789"; |
| 14 static const int kTestDataSize = arraysize(kTestData) - 1; | 14 static const int kTestDataSize = arraysize(kTestData) - 1; |
| 15 | 15 |
| 16 class FileStreamTest : public PlatformTest { | 16 class FileStreamTest : public PlatformTest { |
| 17 public: | 17 public: |
| 18 virtual void SetUp() { | 18 virtual void SetUp() { |
| 19 PlatformTest::SetUp(); | 19 PlatformTest::SetUp(); |
| 20 | 20 |
| 21 file_util::CreateTemporaryFileName(&temp_file_path_); | 21 file_util::CreateTemporaryFileName(&temp_file_path_); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 rv = stream.Write(kTestData, kTestDataSize, NULL); | 360 rv = stream.Write(kTestData, kTestDataSize, NULL); |
| 361 EXPECT_EQ(kTestDataSize, rv); | 361 EXPECT_EQ(kTestDataSize, rv); |
| 362 stream.Close(); | 362 stream.Close(); |
| 363 | 363 |
| 364 ok = file_util::GetFileSize(temp_file_path(), &file_size); | 364 ok = file_util::GetFileSize(temp_file_path(), &file_size); |
| 365 EXPECT_TRUE(ok); | 365 EXPECT_TRUE(ok); |
| 366 EXPECT_EQ(kTestDataSize * 2, file_size); | 366 EXPECT_EQ(kTestDataSize * 2, file_size); |
| 367 } | 367 } |
| 368 | 368 |
| 369 // TODO(erikkay): more READ_WRITE tests? | 369 // TODO(erikkay): more READ_WRITE tests? |
| OLD | NEW |