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

Side by Side Diff: components/resource_provider/resource_provider_apptest.cc

Issue 1725353003: Eliminate mojo::Shell client lib class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@15connector
Patch Set: . Created 4 years, 9 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 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"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 ResourceProviderApplicationTest() {} 48 ResourceProviderApplicationTest() {}
49 ~ResourceProviderApplicationTest() override {} 49 ~ResourceProviderApplicationTest() override {}
50 50
51 protected: 51 protected:
52 using ResourceContentsMap = std::map<std::string, std::string>; 52 using ResourceContentsMap = std::map<std::string, std::string>;
53 53
54 // Queries ResourceProvider for the specified resources, blocking until the 54 // Queries ResourceProvider for the specified resources, blocking until the
55 // resources are returned. The return map maps from the path to the contents 55 // resources are returned. The return map maps from the path to the contents
56 // of the file at the specified path. 56 // of the file at the specified path.
57 ResourceContentsMap GetResources(const std::set<std::string>& paths) { 57 ResourceContentsMap GetResources(const std::set<std::string>& paths) {
58 ResourceLoader loader(shell(), paths); 58 ResourceLoader loader(connector(), paths);
59 loader.BlockUntilLoaded(); 59 loader.BlockUntilLoaded();
60 60
61 // Load the contents of each of the handles. 61 // Load the contents of each of the handles.
62 ResourceContentsMap results; 62 ResourceContentsMap results;
63 for (auto& path : paths) { 63 for (auto& path : paths) {
64 base::File file(loader.ReleaseFile(path)); 64 base::File file(loader.ReleaseFile(path));
65 results[path] = ReadFile(&file); 65 results[path] = ReadFile(&file);
66 } 66 }
67 return results; 67 return results;
68 } 68 }
(...skipping 18 matching lines...) Expand all
87 GetResources(SetWithStrings("sample", "dir/sample2"))); 87 GetResources(SetWithStrings("sample", "dir/sample2")));
88 ASSERT_TRUE(results.count("sample") > 0u); 88 ASSERT_TRUE(results.count("sample") > 0u);
89 EXPECT_EQ("test data\n", results["sample"]); 89 EXPECT_EQ("test data\n", results["sample"]);
90 90
91 ASSERT_TRUE(results.count("dir/sample2") > 0u); 91 ASSERT_TRUE(results.count("dir/sample2") > 0u);
92 EXPECT_EQ("xxyy\n", results["dir/sample2"]); 92 EXPECT_EQ("xxyy\n", results["dir/sample2"]);
93 } 93 }
94 94
95 } // namespace 95 } // namespace
96 } // namespace resource_provider 96 } // namespace resource_provider
OLDNEW
« no previous file with comments | « components/resource_provider/resource_provider_app.cc ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698