Index: chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc |
diff --git a/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc |
index 09662a7bc1e733c43ac81c13dd6a9e0159ebf359..c3975267a1cb0fff4add2f2d112e407a1bcedef8 100644 |
--- a/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc |
+++ b/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc |
@@ -54,6 +54,8 @@ class FileSystemProviderOperationsWriteFileTest : public testing::Test { |
}; |
TEST_F(FileSystemProviderOperationsWriteFileTest, Execute) { |
+ using extensions::api::file_system_provider::WriteFileRequestedOptions; |
+ |
util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); |
util::StatusCallbackLog callback_log; |
@@ -78,32 +80,16 @@ TEST_F(FileSystemProviderOperationsWriteFileTest, Execute) { |
base::ListValue* event_args = event->event_args.get(); |
ASSERT_EQ(1u, event_args->GetSize()); |
- base::DictionaryValue* options = NULL; |
- ASSERT_TRUE(event_args->GetDictionary(0, &options)); |
- |
- std::string event_file_system_id; |
- EXPECT_TRUE(options->GetString("fileSystemId", &event_file_system_id)); |
- EXPECT_EQ(kFileSystemId, event_file_system_id); |
- |
- int event_request_id = -1; |
- EXPECT_TRUE(options->GetInteger("requestId", &event_request_id)); |
- EXPECT_EQ(kRequestId, event_request_id); |
- |
- int event_file_handle = -1; |
- EXPECT_TRUE(options->GetInteger("openRequestId", &event_file_handle)); |
- EXPECT_EQ(kFileHandle, event_file_handle); |
- |
- double event_offset = -1; |
- EXPECT_TRUE(options->GetDouble("offset", &event_offset)); |
- EXPECT_EQ(kOffset, static_cast<double>(event_offset)); |
+ const base::DictionaryValue* options_as_value = NULL; |
+ ASSERT_TRUE(event_args->GetDictionary(0, &options_as_value)); |
- base::BinaryValue* event_data = NULL; |
- ASSERT_TRUE(options->GetBinary("data", &event_data)); |
- EXPECT_EQ(static_cast<size_t>(io_buffer_->size()), event_data->GetSize()); |
- char* const event_data_buffer = event_data->GetBuffer(); |
- ASSERT_TRUE(event_data_buffer); |
- EXPECT_EQ(std::string(kWriteData), |
- std::string(event_data_buffer, event_data->GetSize())); |
+ WriteFileRequestedOptions options; |
+ ASSERT_TRUE(WriteFileRequestedOptions::Populate(*options_as_value, &options)); |
+ EXPECT_EQ(kFileSystemId, options.file_system_id); |
+ EXPECT_EQ(kRequestId, options.request_id); |
+ EXPECT_EQ(kFileHandle, options.open_request_id); |
+ EXPECT_EQ(kOffset, static_cast<double>(options.offset)); |
+ EXPECT_EQ(std::string(kWriteData), options.data); |
} |
TEST_F(FileSystemProviderOperationsWriteFileTest, Execute_NoListener) { |