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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc

Issue 820673004: json_schema_compiler: Use std::vector<char> for binary values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simplify_json_schema
Patch Set: Fix merge error. Created 5 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/chromeos/file_system_provider/operations/write_file.h" 5 #include "chrome/browser/chromeos/file_system_provider/operations/write_file.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector>
8 9
9 #include "base/files/file.h" 10 #include "base/files/file.h"
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
14 #include "base/values.h" 16 #include "base/values.h"
15 #include "chrome/browser/chromeos/file_system_provider/operations/test_util.h" 17 #include "chrome/browser/chromeos/file_system_provider/operations/test_util.h"
16 #include "chrome/common/extensions/api/file_system_provider.h" 18 #include "chrome/common/extensions/api/file_system_provider.h"
17 #include "chrome/common/extensions/api/file_system_provider_internal.h" 19 #include "chrome/common/extensions/api/file_system_provider_internal.h"
18 #include "extensions/browser/event_router.h" 20 #include "extensions/browser/event_router.h"
19 #include "net/base/io_buffer.h" 21 #include "net/base/io_buffer.h"
20 #include "storage/browser/fileapi/async_file_util.h" 22 #include "storage/browser/fileapi/async_file_util.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 82
81 const base::DictionaryValue* options_as_value = NULL; 83 const base::DictionaryValue* options_as_value = NULL;
82 ASSERT_TRUE(event_args->GetDictionary(0, &options_as_value)); 84 ASSERT_TRUE(event_args->GetDictionary(0, &options_as_value));
83 85
84 WriteFileRequestedOptions options; 86 WriteFileRequestedOptions options;
85 ASSERT_TRUE(WriteFileRequestedOptions::Populate(*options_as_value, &options)); 87 ASSERT_TRUE(WriteFileRequestedOptions::Populate(*options_as_value, &options));
86 EXPECT_EQ(kFileSystemId, options.file_system_id); 88 EXPECT_EQ(kFileSystemId, options.file_system_id);
87 EXPECT_EQ(kRequestId, options.request_id); 89 EXPECT_EQ(kRequestId, options.request_id);
88 EXPECT_EQ(kFileHandle, options.open_request_id); 90 EXPECT_EQ(kFileHandle, options.open_request_id);
89 EXPECT_EQ(kOffset, static_cast<double>(options.offset)); 91 EXPECT_EQ(kOffset, static_cast<double>(options.offset));
90 EXPECT_EQ(std::string(kWriteData), options.data); 92 std::string write_data(kWriteData);
93 EXPECT_EQ(std::vector<char>(write_data.begin(), write_data.end()),
94 options.data);
91 } 95 }
92 96
93 TEST_F(FileSystemProviderOperationsWriteFileTest, Execute_NoListener) { 97 TEST_F(FileSystemProviderOperationsWriteFileTest, Execute_NoListener) {
94 util::LoggingDispatchEventImpl dispatcher(false /* dispatch_reply */); 98 util::LoggingDispatchEventImpl dispatcher(false /* dispatch_reply */);
95 util::StatusCallbackLog callback_log; 99 util::StatusCallbackLog callback_log;
96 100
97 WriteFile write_file(NULL, 101 WriteFile write_file(NULL,
98 file_system_info_, 102 file_system_info_,
99 kFileHandle, 103 kFileHandle,
100 io_buffer_.get(), 104 io_buffer_.get(),
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 scoped_ptr<RequestValue>(new RequestValue()), 180 scoped_ptr<RequestValue>(new RequestValue()),
177 base::File::FILE_ERROR_TOO_MANY_OPENED); 181 base::File::FILE_ERROR_TOO_MANY_OPENED);
178 182
179 ASSERT_EQ(1u, callback_log.size()); 183 ASSERT_EQ(1u, callback_log.size());
180 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]); 184 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]);
181 } 185 }
182 186
183 } // namespace operations 187 } // namespace operations
184 } // namespace file_system_provider 188 } // namespace file_system_provider
185 } // namespace chromeos 189 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698