| Index: components/filesystem/file_impl_unittest.cc | 
| diff --git a/components/filesystem/file_impl_unittest.cc b/components/filesystem/file_impl_unittest.cc | 
| index 39ab57f62b59114b9366db500dba333f30102899..d20cecc4075ed44ace928ba5f78630812e697735 100644 | 
| --- a/components/filesystem/file_impl_unittest.cc | 
| +++ b/components/filesystem/file_impl_unittest.cc | 
| @@ -21,9 +21,9 @@ TEST_F(FileImplTest, CreateWriteCloseRenameOpenRead) { | 
| { | 
| // Create my_file. | 
| FilePtr file; | 
| -    error = ERROR_INTERNAL; | 
| -    directory->OpenFile("my_file", GetProxy(&file), | 
| -                        kOpenFlagWrite | kOpenFlagCreate, Capture(&error)); | 
| +    error = ERROR_FAILED; | 
| +    directory->OpenFile("my_file", GetProxy(&file), kFlagWrite | kFlagCreate, | 
| +                        Capture(&error)); | 
| ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| @@ -34,7 +34,7 @@ TEST_F(FileImplTest, CreateWriteCloseRenameOpenRead) { | 
| bytes_to_write.push_back(static_cast<uint8_t>('l')); | 
| bytes_to_write.push_back(static_cast<uint8_t>('l')); | 
| bytes_to_write.push_back(static_cast<uint8_t>('o')); | 
| -    error = ERROR_INTERNAL; | 
| +    error = ERROR_FAILED; | 
| uint32_t num_bytes_written = 0; | 
| file->Write(mojo::Array<uint8_t>::From(bytes_to_write), 0, | 
| WHENCE_FROM_CURRENT, Capture(&error, &num_bytes_written)); | 
| @@ -43,14 +43,14 @@ TEST_F(FileImplTest, CreateWriteCloseRenameOpenRead) { | 
| EXPECT_EQ(bytes_to_write.size(), num_bytes_written); | 
|  | 
| // Close it. | 
| -    error = ERROR_INTERNAL; | 
| +    error = ERROR_FAILED; | 
| file->Close(Capture(&error)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
| } | 
|  | 
| // Rename it. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| directory->Rename("my_file", "your_file", Capture(&error)); | 
| ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
| @@ -58,16 +58,16 @@ TEST_F(FileImplTest, CreateWriteCloseRenameOpenRead) { | 
| { | 
| // Open my_file again. | 
| FilePtr file; | 
| -    error = ERROR_INTERNAL; | 
| -    directory->OpenFile("your_file", GetProxy(&file), kOpenFlagRead, | 
| +    error = ERROR_FAILED; | 
| +    directory->OpenFile("your_file", GetProxy(&file), kFlagRead | kFlagOpen, | 
| Capture(&error)); | 
| ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| // Read from it. | 
| mojo::Array<uint8_t> bytes_read; | 
| -    error = ERROR_INTERNAL; | 
| -    file->Read(3, 1, WHENCE_FROM_START, Capture(&error, &bytes_read)); | 
| +    error = ERROR_FAILED; | 
| +    file->Read(3, 1, WHENCE_FROM_BEGIN, Capture(&error, &bytes_read)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
| ASSERT_EQ(3u, bytes_read.size()); | 
| @@ -94,14 +94,14 @@ TEST_F(FileImplTest, CantWriteInReadMode) { | 
| { | 
| // Create my_file. | 
| FilePtr file; | 
| -    error = ERROR_INTERNAL; | 
| -    directory->OpenFile("my_file", GetProxy(&file), | 
| -                        kOpenFlagWrite | kOpenFlagCreate, Capture(&error)); | 
| +    error = ERROR_FAILED; | 
| +    directory->OpenFile("my_file", GetProxy(&file), kFlagWrite | kFlagCreate, | 
| +                        Capture(&error)); | 
| ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| // Write to it. | 
| -    error = ERROR_INTERNAL; | 
| +    error = ERROR_FAILED; | 
| uint32_t num_bytes_written = 0; | 
| file->Write(mojo::Array<uint8_t>::From(bytes_to_write), 0, | 
| WHENCE_FROM_CURRENT, Capture(&error, &num_bytes_written)); | 
| @@ -110,7 +110,7 @@ TEST_F(FileImplTest, CantWriteInReadMode) { | 
| EXPECT_EQ(bytes_to_write.size(), num_bytes_written); | 
|  | 
| // Close it. | 
| -    error = ERROR_INTERNAL; | 
| +    error = ERROR_FAILED; | 
| file->Close(Capture(&error)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
| @@ -119,61 +119,28 @@ TEST_F(FileImplTest, CantWriteInReadMode) { | 
| { | 
| // Open my_file again, this time with read only mode. | 
| FilePtr file; | 
| -    error = ERROR_INTERNAL; | 
| -    directory->OpenFile("my_file", GetProxy(&file), kOpenFlagRead, | 
| +    error = ERROR_FAILED; | 
| +    directory->OpenFile("my_file", GetProxy(&file), kFlagRead | kFlagOpen, | 
| Capture(&error)); | 
| ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| // Try to write in read mode; it should fail. | 
| -    error = ERROR_INTERNAL; | 
| +    error = ERROR_OK; | 
| uint32_t num_bytes_written = 0; | 
| file->Write(mojo::Array<uint8_t>::From(bytes_to_write), 0, | 
| WHENCE_FROM_CURRENT, Capture(&error, &num_bytes_written)); | 
| -    ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| -    EXPECT_EQ(ERROR_UNKNOWN, error); | 
| -    EXPECT_EQ(0u, num_bytes_written); | 
|  | 
| -    // Close it. | 
| -    error = ERROR_INTERNAL; | 
| -    file->Close(Capture(&error)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| -    EXPECT_EQ(ERROR_OK, error); | 
| -  } | 
| -} | 
| - | 
| -TEST_F(FileImplTest, OpenExclusive) { | 
| -  DirectoryPtr directory; | 
| -  GetTemporaryRoot(&directory); | 
| -  Error error; | 
| - | 
| -  { | 
| -    // Create my_file. | 
| -    FilePtr file; | 
| -    error = ERROR_INTERNAL; | 
| -    directory->OpenFile("temp_file", GetProxy(&file), | 
| -                        kOpenFlagWrite | kOpenFlagCreate |kOpenFlagExclusive, | 
| -                        Capture(&error)); | 
| -    ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| -    EXPECT_EQ(ERROR_OK, error); | 
| +    EXPECT_EQ(ERROR_FAILED, error); | 
| +    EXPECT_EQ(0u, num_bytes_written); | 
|  | 
| // Close it. | 
| -    error = ERROR_INTERNAL; | 
| +    error = ERROR_FAILED; | 
| file->Close(Capture(&error)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
| } | 
| - | 
| -  { | 
| -    // Try to open my_file again in exclusive mode; it should fail. | 
| -    FilePtr file; | 
| -    error = ERROR_INTERNAL; | 
| -    directory->OpenFile("temp_file", GetProxy(&file), | 
| -                        kOpenFlagWrite | kOpenFlagCreate | kOpenFlagExclusive, | 
| -                        Capture(&error)); | 
| -    ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| -    EXPECT_EQ(ERROR_UNKNOWN, error); | 
| -  } | 
| } | 
|  | 
| TEST_F(FileImplTest, OpenInAppendMode) { | 
| @@ -184,9 +151,9 @@ TEST_F(FileImplTest, OpenInAppendMode) { | 
| { | 
| // Create my_file. | 
| FilePtr file; | 
| -    error = ERROR_INTERNAL; | 
| -    directory->OpenFile("my_file", GetProxy(&file), | 
| -                        kOpenFlagWrite | kOpenFlagCreate, Capture(&error)); | 
| +    error = ERROR_FAILED; | 
| +    directory->OpenFile("my_file", GetProxy(&file), kFlagWrite | kFlagCreate, | 
| +                        Capture(&error)); | 
| ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| @@ -197,7 +164,7 @@ TEST_F(FileImplTest, OpenInAppendMode) { | 
| bytes_to_write.push_back(static_cast<uint8_t>('l')); | 
| bytes_to_write.push_back(static_cast<uint8_t>('l')); | 
| bytes_to_write.push_back(static_cast<uint8_t>('o')); | 
| -    error = ERROR_INTERNAL; | 
| +    error = ERROR_FAILED; | 
| uint32_t num_bytes_written = 0; | 
| file->Write(mojo::Array<uint8_t>::From(bytes_to_write), 0, | 
| WHENCE_FROM_CURRENT, Capture(&error, &num_bytes_written)); | 
| @@ -206,7 +173,7 @@ TEST_F(FileImplTest, OpenInAppendMode) { | 
| EXPECT_EQ(bytes_to_write.size(), num_bytes_written); | 
|  | 
| // Close it. | 
| -    error = ERROR_INTERNAL; | 
| +    error = ERROR_FAILED; | 
| file->Close(Capture(&error)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
| @@ -215,9 +182,9 @@ TEST_F(FileImplTest, OpenInAppendMode) { | 
| { | 
| // Append to my_file. | 
| FilePtr file; | 
| -    error = ERROR_INTERNAL; | 
| -    directory->OpenFile("my_file", GetProxy(&file), | 
| -                        kOpenFlagWrite | kOpenFlagAppend, Capture(&error)); | 
| +    error = ERROR_FAILED; | 
| +    directory->OpenFile("my_file", GetProxy(&file), kFlagAppend | kFlagOpen, | 
| +                        Capture(&error)); | 
| ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| @@ -230,7 +197,7 @@ TEST_F(FileImplTest, OpenInAppendMode) { | 
| bytes_to_write.push_back(static_cast<uint8_t>('b')); | 
| bytes_to_write.push_back(static_cast<uint8_t>('y')); | 
| bytes_to_write.push_back(static_cast<uint8_t>('e')); | 
| -    error = ERROR_INTERNAL; | 
| +    error = ERROR_FAILED; | 
| uint32_t num_bytes_written = 0; | 
| file->Write(mojo::Array<uint8_t>::From(bytes_to_write), 0, | 
| WHENCE_FROM_CURRENT, Capture(&error, &num_bytes_written)); | 
| @@ -239,7 +206,7 @@ TEST_F(FileImplTest, OpenInAppendMode) { | 
| EXPECT_EQ(bytes_to_write.size(), num_bytes_written); | 
|  | 
| // Close it. | 
| -    error = ERROR_INTERNAL; | 
| +    error = ERROR_FAILED; | 
| file->Close(Capture(&error)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
| @@ -248,16 +215,16 @@ TEST_F(FileImplTest, OpenInAppendMode) { | 
| { | 
| // Open my_file again. | 
| FilePtr file; | 
| -    error = ERROR_INTERNAL; | 
| -    directory->OpenFile("my_file", GetProxy(&file), kOpenFlagRead, | 
| +    error = ERROR_FAILED; | 
| +    directory->OpenFile("my_file", GetProxy(&file), kFlagRead | kFlagOpen, | 
| Capture(&error)); | 
| ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| // Read from it. | 
| mojo::Array<uint8_t> bytes_read; | 
| -    error = ERROR_INTERNAL; | 
| -    file->Read(12, 0, WHENCE_FROM_START, Capture(&error, &bytes_read)); | 
| +    error = ERROR_FAILED; | 
| +    file->Read(12, 0, WHENCE_FROM_BEGIN, Capture(&error, &bytes_read)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
| ASSERT_EQ(12u, bytes_read.size()); | 
| @@ -276,9 +243,9 @@ TEST_F(FileImplTest, OpenInTruncateMode) { | 
| { | 
| // Create my_file. | 
| FilePtr file; | 
| -    error = ERROR_INTERNAL; | 
| -    directory->OpenFile("my_file", GetProxy(&file), | 
| -                        kOpenFlagWrite | kOpenFlagCreate, Capture(&error)); | 
| +    error = ERROR_FAILED; | 
| +    directory->OpenFile("my_file", GetProxy(&file), kFlagWrite | kFlagCreate, | 
| +                        Capture(&error)); | 
| ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| @@ -289,7 +256,7 @@ TEST_F(FileImplTest, OpenInTruncateMode) { | 
| bytes_to_write.push_back(static_cast<uint8_t>('l')); | 
| bytes_to_write.push_back(static_cast<uint8_t>('l')); | 
| bytes_to_write.push_back(static_cast<uint8_t>('o')); | 
| -    error = ERROR_INTERNAL; | 
| +    error = ERROR_FAILED; | 
| uint32_t num_bytes_written = 0; | 
| file->Write(mojo::Array<uint8_t>::From(bytes_to_write), 0, | 
| WHENCE_FROM_CURRENT, Capture(&error, &num_bytes_written)); | 
| @@ -298,7 +265,7 @@ TEST_F(FileImplTest, OpenInTruncateMode) { | 
| EXPECT_EQ(bytes_to_write.size(), num_bytes_written); | 
|  | 
| // Close it. | 
| -    error = ERROR_INTERNAL; | 
| +    error = ERROR_FAILED; | 
| file->Close(Capture(&error)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
| @@ -307,9 +274,9 @@ TEST_F(FileImplTest, OpenInTruncateMode) { | 
| { | 
| // Append to my_file. | 
| FilePtr file; | 
| -    error = ERROR_INTERNAL; | 
| +    error = ERROR_FAILED; | 
| directory->OpenFile("my_file", GetProxy(&file), | 
| -                        kOpenFlagWrite | kOpenFlagTruncate, Capture(&error)); | 
| +                        kFlagWrite | kFlagOpenTruncated, Capture(&error)); | 
| ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| @@ -322,7 +289,7 @@ TEST_F(FileImplTest, OpenInTruncateMode) { | 
| bytes_to_write.push_back(static_cast<uint8_t>('b')); | 
| bytes_to_write.push_back(static_cast<uint8_t>('y')); | 
| bytes_to_write.push_back(static_cast<uint8_t>('e')); | 
| -    error = ERROR_INTERNAL; | 
| +    error = ERROR_FAILED; | 
| uint32_t num_bytes_written = 0; | 
| file->Write(mojo::Array<uint8_t>::From(bytes_to_write), 0, | 
| WHENCE_FROM_CURRENT, Capture(&error, &num_bytes_written)); | 
| @@ -331,7 +298,7 @@ TEST_F(FileImplTest, OpenInTruncateMode) { | 
| EXPECT_EQ(bytes_to_write.size(), num_bytes_written); | 
|  | 
| // Close it. | 
| -    error = ERROR_INTERNAL; | 
| +    error = ERROR_FAILED; | 
| file->Close(Capture(&error)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
| @@ -340,16 +307,16 @@ TEST_F(FileImplTest, OpenInTruncateMode) { | 
| { | 
| // Open my_file again. | 
| FilePtr file; | 
| -    error = ERROR_INTERNAL; | 
| -    directory->OpenFile("my_file", GetProxy(&file), kOpenFlagRead, | 
| +    error = ERROR_FAILED; | 
| +    directory->OpenFile("my_file", GetProxy(&file), kFlagRead | kFlagOpen, | 
| Capture(&error)); | 
| ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| // Read from it. | 
| mojo::Array<uint8_t> bytes_read; | 
| -    error = ERROR_INTERNAL; | 
| -    file->Read(7, 0, WHENCE_FROM_START, Capture(&error, &bytes_read)); | 
| +    error = ERROR_FAILED; | 
| +    file->Read(7, 0, WHENCE_FROM_BEGIN, Capture(&error, &bytes_read)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
| ASSERT_EQ(7u, bytes_read.size()); | 
| @@ -369,14 +336,14 @@ TEST_F(FileImplTest, StatTouch) { | 
|  | 
| // Create my_file. | 
| FilePtr file; | 
| -  error = ERROR_INTERNAL; | 
| -  directory->OpenFile("my_file", GetProxy(&file), | 
| -                      kOpenFlagWrite | kOpenFlagCreate, Capture(&error)); | 
| +  error = ERROR_FAILED; | 
| +  directory->OpenFile("my_file", GetProxy(&file), kFlagWrite | kFlagCreate, | 
| +                      Capture(&error)); | 
| ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| // Stat it. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| FileInformationPtr file_info; | 
| file->Stat(Capture(&error, &file_info)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| @@ -384,56 +351,48 @@ TEST_F(FileImplTest, StatTouch) { | 
| ASSERT_FALSE(file_info.is_null()); | 
| EXPECT_EQ(FILE_TYPE_REGULAR_FILE, file_info->type); | 
| EXPECT_EQ(0, file_info->size); | 
| -  ASSERT_FALSE(file_info->atime.is_null()); | 
| -  EXPECT_GT(file_info->atime->seconds, 0);  // Expect that it's not 1970-01-01. | 
| -  ASSERT_FALSE(file_info->mtime.is_null()); | 
| -  EXPECT_GT(file_info->mtime->seconds, 0); | 
| -  int64_t first_mtime = file_info->mtime->seconds; | 
| +  EXPECT_GT(file_info->atime, 0);  // Expect that it's not 1970-01-01. | 
| +  EXPECT_GT(file_info->mtime, 0); | 
| +  double first_mtime = file_info->mtime; | 
|  | 
| // Touch only the atime. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| TimespecOrNowPtr t(TimespecOrNow::New()); | 
| t->now = false; | 
| -  t->timespec = Timespec::New(); | 
| const int64_t kPartyTime1 = 1234567890;  // Party like it's 2009-02-13. | 
| -  t->timespec->seconds = kPartyTime1; | 
| +  t->seconds = kPartyTime1; | 
| file->Touch(t.Pass(), nullptr, Capture(&error)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| // Stat again. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| file_info.reset(); | 
| file->Stat(Capture(&error, &file_info)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
| ASSERT_FALSE(file_info.is_null()); | 
| -  ASSERT_FALSE(file_info->atime.is_null()); | 
| -  EXPECT_EQ(kPartyTime1, file_info->atime->seconds); | 
| -  ASSERT_FALSE(file_info->mtime.is_null()); | 
| -  EXPECT_EQ(first_mtime, file_info->mtime->seconds); | 
| +  EXPECT_EQ(kPartyTime1, file_info->atime); | 
| +  EXPECT_EQ(first_mtime, file_info->mtime); | 
|  | 
| // Touch only the mtime. | 
| t = TimespecOrNow::New(); | 
| t->now = false; | 
| -  t->timespec = Timespec::New(); | 
| const int64_t kPartyTime2 = 1425059525;  // No time like the present. | 
| -  t->timespec->seconds = kPartyTime2; | 
| +  t->seconds = kPartyTime2; | 
| file->Touch(nullptr, t.Pass(), Capture(&error)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| // Stat again. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| file_info.reset(); | 
| file->Stat(Capture(&error, &file_info)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
| ASSERT_FALSE(file_info.is_null()); | 
| -  ASSERT_FALSE(file_info->atime.is_null()); | 
| -  EXPECT_EQ(kPartyTime1, file_info->atime->seconds); | 
| -  ASSERT_FALSE(file_info->mtime.is_null()); | 
| -  EXPECT_EQ(kPartyTime2, file_info->mtime->seconds); | 
| +  EXPECT_EQ(kPartyTime1, file_info->atime); | 
| +  EXPECT_EQ(kPartyTime2, file_info->mtime); | 
|  | 
| // TODO(vtl): Also test non-zero file size. | 
| // TODO(vtl): Also test Touch() "now" options. | 
| @@ -447,15 +406,15 @@ TEST_F(FileImplTest, TellSeek) { | 
|  | 
| // Create my_file. | 
| FilePtr file; | 
| -  error = ERROR_INTERNAL; | 
| -  directory->OpenFile("my_file", GetProxy(&file), | 
| -                      kOpenFlagWrite | kOpenFlagCreate, Capture(&error)); | 
| +  error = ERROR_FAILED; | 
| +  directory->OpenFile("my_file", GetProxy(&file), kFlagWrite | kFlagCreate, | 
| +                      Capture(&error)); | 
| ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| // Write to it. | 
| std::vector<uint8_t> bytes_to_write(1000, '!'); | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| uint32_t num_bytes_written = 0; | 
| file->Write(mojo::Array<uint8_t>::From(bytes_to_write), 0, | 
| WHENCE_FROM_CURRENT, Capture(&error, &num_bytes_written)); | 
| @@ -465,7 +424,7 @@ TEST_F(FileImplTest, TellSeek) { | 
| const int size = static_cast<int>(num_bytes_written); | 
|  | 
| // Tell. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| int64_t position = -1; | 
| file->Tell(Capture(&error, &position)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| @@ -474,7 +433,7 @@ TEST_F(FileImplTest, TellSeek) { | 
| EXPECT_EQ(size, position); | 
|  | 
| // Seek back 100. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| position = -1; | 
| file->Seek(-100, WHENCE_FROM_CURRENT, Capture(&error, &position)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| @@ -482,7 +441,7 @@ TEST_F(FileImplTest, TellSeek) { | 
| EXPECT_EQ(size - 100, position); | 
|  | 
| // Tell. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| position = -1; | 
| file->Tell(Capture(&error, &position)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| @@ -490,15 +449,15 @@ TEST_F(FileImplTest, TellSeek) { | 
| EXPECT_EQ(size - 100, position); | 
|  | 
| // Seek to 123 from start. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| position = -1; | 
| -  file->Seek(123, WHENCE_FROM_START, Capture(&error, &position)); | 
| +  file->Seek(123, WHENCE_FROM_BEGIN, Capture(&error, &position)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
| EXPECT_EQ(123, position); | 
|  | 
| // Tell. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| position = -1; | 
| file->Tell(Capture(&error, &position)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| @@ -506,7 +465,7 @@ TEST_F(FileImplTest, TellSeek) { | 
| EXPECT_EQ(123, position); | 
|  | 
| // Seek to 123 back from end. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| position = -1; | 
| file->Seek(-123, WHENCE_FROM_END, Capture(&error, &position)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| @@ -514,7 +473,7 @@ TEST_F(FileImplTest, TellSeek) { | 
| EXPECT_EQ(size - 123, position); | 
|  | 
| // Tell. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| position = -1; | 
| file->Tell(Capture(&error, &position)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| @@ -532,10 +491,9 @@ TEST_F(FileImplTest, Dup) { | 
|  | 
| // Create my_file. | 
| FilePtr file1; | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| directory->OpenFile("my_file", GetProxy(&file1), | 
| -                      kOpenFlagRead | kOpenFlagWrite | kOpenFlagCreate, | 
| -                      Capture(&error)); | 
| +                      kFlagRead | kFlagWrite | kFlagCreate, Capture(&error)); | 
| ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| @@ -546,7 +504,7 @@ TEST_F(FileImplTest, Dup) { | 
| bytes_to_write.push_back(static_cast<uint8_t>('l')); | 
| bytes_to_write.push_back(static_cast<uint8_t>('l')); | 
| bytes_to_write.push_back(static_cast<uint8_t>('o')); | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| uint32_t num_bytes_written = 0; | 
| file1->Write(mojo::Array<uint8_t>::From(bytes_to_write), 0, | 
| WHENCE_FROM_CURRENT, Capture(&error, &num_bytes_written)); | 
| @@ -557,13 +515,13 @@ TEST_F(FileImplTest, Dup) { | 
|  | 
| // Dup it. | 
| FilePtr file2; | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| file1->Dup(GetProxy(&file2), Capture(&error)); | 
| ASSERT_TRUE(file1.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| // |file2| should have the same position. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| int64_t position = -1; | 
| file2->Tell(Capture(&error, &position)); | 
| ASSERT_TRUE(file2.WaitForIncomingResponse()); | 
| @@ -577,7 +535,7 @@ TEST_F(FileImplTest, Dup) { | 
| more_bytes_to_write.push_back(static_cast<uint8_t>('r')); | 
| more_bytes_to_write.push_back(static_cast<uint8_t>('l')); | 
| more_bytes_to_write.push_back(static_cast<uint8_t>('d')); | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| num_bytes_written = 0; | 
| file2->Write(mojo::Array<uint8_t>::From(more_bytes_to_write), 0, | 
| WHENCE_FROM_CURRENT, Capture(&error, &num_bytes_written)); | 
| @@ -587,7 +545,7 @@ TEST_F(FileImplTest, Dup) { | 
| const int end_world_pos = end_hello_pos + static_cast<int>(num_bytes_written); | 
|  | 
| // |file1| should have the same position. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| position = -1; | 
| file1->Tell(Capture(&error, &position)); | 
| ASSERT_TRUE(file1.WaitForIncomingResponse()); | 
| @@ -595,15 +553,15 @@ TEST_F(FileImplTest, Dup) { | 
| EXPECT_EQ(end_world_pos, position); | 
|  | 
| // Close |file1|. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| file1->Close(Capture(&error)); | 
| ASSERT_TRUE(file1.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| // Read everything using |file2|. | 
| mojo::Array<uint8_t> bytes_read; | 
| -  error = ERROR_INTERNAL; | 
| -  file2->Read(1000, 0, WHENCE_FROM_START, Capture(&error, &bytes_read)); | 
| +  error = ERROR_FAILED; | 
| +  file2->Read(1000, 0, WHENCE_FROM_BEGIN, Capture(&error, &bytes_read)); | 
| ASSERT_TRUE(file2.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
| ASSERT_EQ(static_cast<size_t>(end_world_pos), bytes_read.size()); | 
| @@ -624,15 +582,15 @@ TEST_F(FileImplTest, Truncate) { | 
|  | 
| // Create my_file. | 
| FilePtr file; | 
| -  error = ERROR_INTERNAL; | 
| -  directory->OpenFile("my_file", GetProxy(&file), | 
| -                      kOpenFlagWrite | kOpenFlagCreate, Capture(&error)); | 
| +  error = ERROR_FAILED; | 
| +  directory->OpenFile("my_file", GetProxy(&file), kFlagWrite | kFlagCreate, | 
| +                      Capture(&error)); | 
| ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| // Write to it. | 
| std::vector<uint8_t> bytes_to_write(kInitialSize, '!'); | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| uint32_t num_bytes_written = 0; | 
| file->Write(mojo::Array<uint8_t>::From(bytes_to_write), 0, | 
| WHENCE_FROM_CURRENT, Capture(&error, &num_bytes_written)); | 
| @@ -641,7 +599,7 @@ TEST_F(FileImplTest, Truncate) { | 
| EXPECT_EQ(kInitialSize, num_bytes_written); | 
|  | 
| // Stat it. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| FileInformationPtr file_info; | 
| file->Stat(Capture(&error, &file_info)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| @@ -650,13 +608,13 @@ TEST_F(FileImplTest, Truncate) { | 
| EXPECT_EQ(kInitialSize, file_info->size); | 
|  | 
| // Truncate it. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| file->Truncate(kTruncatedSize, Capture(&error)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| EXPECT_EQ(ERROR_OK, error); | 
|  | 
| // Stat again. | 
| -  error = ERROR_INTERNAL; | 
| +  error = ERROR_FAILED; | 
| file_info.reset(); | 
| file->Stat(Capture(&error, &file_info)); | 
| ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| @@ -665,27 +623,5 @@ TEST_F(FileImplTest, Truncate) { | 
| EXPECT_EQ(kTruncatedSize, file_info->size); | 
| } | 
|  | 
| -TEST_F(FileImplTest, Ioctl) { | 
| -  DirectoryPtr directory; | 
| -  GetTemporaryRoot(&directory); | 
| -  Error error; | 
| - | 
| -  // Create my_file. | 
| -  FilePtr file; | 
| -  error = ERROR_INTERNAL; | 
| -  directory->OpenFile("my_file", GetProxy(&file), | 
| -                      kOpenFlagRead | kOpenFlagWrite | kOpenFlagCreate, | 
| -                      Capture(&error)); | 
| -  ASSERT_TRUE(directory.WaitForIncomingResponse()); | 
| -  EXPECT_EQ(ERROR_OK, error); | 
| - | 
| -  // Normal files don't support any ioctls. | 
| -  mojo::Array<uint32_t> out_values; | 
| -  file->Ioctl(0, mojo::Array<uint32_t>(), Capture(&error, &out_values)); | 
| -  ASSERT_TRUE(file.WaitForIncomingResponse()); | 
| -  EXPECT_EQ(ERROR_UNAVAILABLE, error); | 
| -  EXPECT_TRUE(out_values.is_null()); | 
| -} | 
| - | 
| }  // namespace | 
| }  // namespace filesystem | 
|  |