OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "components/resource_provider/public/cpp/resource_loader.h" | 12 #include "components/resource_provider/public/cpp/resource_loader.h" |
13 #include "components/resource_provider/public/interfaces/resource_provider.mojom
.h" | 13 #include "components/resource_provider/public/interfaces/resource_provider.mojom
.h" |
14 #include "mojo/common/common_type_converters.h" | 14 #include "mojo/common/common_type_converters.h" |
15 #include "mojo/platform_handle/platform_handle_functions.h" | 15 #include "mojo/platform_handle/platform_handle_functions.h" |
16 #include "mojo/public/cpp/bindings/array.h" | 16 #include "mojo/public/cpp/bindings/array.h" |
17 #include "mojo/public/cpp/system/macros.h" | 17 #include "mojo/public/cpp/system/macros.h" |
18 #include "mojo/shell/public/cpp/application_delegate.h" | |
19 #include "mojo/shell/public/cpp/application_test_base.h" | 18 #include "mojo/shell/public/cpp/application_test_base.h" |
20 #include "mojo/shell/public/cpp/service_provider_impl.h" | |
21 | 19 |
22 namespace resource_provider { | 20 namespace resource_provider { |
23 namespace { | 21 namespace { |
24 | 22 |
25 std::string ReadFile(base::File* file) { | 23 std::string ReadFile(base::File* file) { |
26 const size_t kBufferSize = 1 << 16; | 24 const size_t kBufferSize = 1 << 16; |
27 scoped_ptr<char[]> buffer(new char[kBufferSize]); | 25 scoped_ptr<char[]> buffer(new char[kBufferSize]); |
28 const int read = file->ReadAtCurrentPos(buffer.get(), kBufferSize); | 26 const int read = file->ReadAtCurrentPos(buffer.get(), kBufferSize); |
29 if (read == -1) | 27 if (read == -1) |
30 return std::string(); | 28 return std::string(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 GetResources(SetWithStrings("sample", "dir/sample2"))); | 87 GetResources(SetWithStrings("sample", "dir/sample2"))); |
90 ASSERT_TRUE(results.count("sample") > 0u); | 88 ASSERT_TRUE(results.count("sample") > 0u); |
91 EXPECT_EQ("test data\n", results["sample"]); | 89 EXPECT_EQ("test data\n", results["sample"]); |
92 | 90 |
93 ASSERT_TRUE(results.count("dir/sample2") > 0u); | 91 ASSERT_TRUE(results.count("dir/sample2") > 0u); |
94 EXPECT_EQ("xxyy\n", results["dir/sample2"]); | 92 EXPECT_EQ("xxyy\n", results["dir/sample2"]); |
95 } | 93 } |
96 | 94 |
97 } // namespace | 95 } // namespace |
98 } // namespace resource_provider | 96 } // namespace resource_provider |
OLD | NEW |