OLD | NEW |
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 <limits> | 5 #include <limits> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // The bindings for the page are generated from a .mojom file. This code looks | 40 // The bindings for the page are generated from a .mojom file. This code looks |
41 // up the generated file from disk and returns it. | 41 // up the generated file from disk and returns it. |
42 bool GetResource(const std::string& id, | 42 bool GetResource(const std::string& id, |
43 const WebUIDataSource::GotDataCallback& callback) { | 43 const WebUIDataSource::GotDataCallback& callback) { |
44 // These are handled by the WebUIDataSource that AddMojoDataSource() creates. | 44 // These are handled by the WebUIDataSource that AddMojoDataSource() creates. |
45 if (id == mojo::kBufferModuleName || | 45 if (id == mojo::kBufferModuleName || |
46 id == mojo::kCodecModuleName || | 46 id == mojo::kCodecModuleName || |
47 id == mojo::kConnectionModuleName || | 47 id == mojo::kConnectionModuleName || |
48 id == mojo::kConnectorModuleName || | 48 id == mojo::kConnectorModuleName || |
49 id == mojo::kUnicodeModuleName || | 49 id == mojo::kUnicodeModuleName || |
50 id == mojo::kRouterModuleName) | 50 id == mojo::kRouterModuleName || |
| 51 id == mojo::kValidatorModuleName) |
51 return false; | 52 return false; |
52 | 53 |
53 std::string contents; | 54 std::string contents; |
54 CHECK(base::ReadFileToString(mojo::test::GetFilePathForJSResource(id), | 55 CHECK(base::ReadFileToString(mojo::test::GetFilePathForJSResource(id), |
55 &contents, | 56 &contents, |
56 std::string::npos)) << id; | 57 std::string::npos)) << id; |
57 base::RefCountedString* ref_contents = new base::RefCountedString; | 58 base::RefCountedString* ref_contents = new base::RefCountedString; |
58 ref_contents->data() = contents; | 59 ref_contents->data() = contents; |
59 callback.Run(ref_contents); | 60 callback.Run(ref_contents); |
60 return true; | 61 return true; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 NavigateToURL(other_shell, test_url); | 230 NavigateToURL(other_shell, test_url); |
230 // RunLoop is quit when message received from page. | 231 // RunLoop is quit when message received from page. |
231 other_run_loop.Run(); | 232 other_run_loop.Run(); |
232 EXPECT_TRUE(got_message); | 233 EXPECT_TRUE(got_message); |
233 EXPECT_EQ(shell()->web_contents()->GetRenderProcessHost(), | 234 EXPECT_EQ(shell()->web_contents()->GetRenderProcessHost(), |
234 other_shell->web_contents()->GetRenderProcessHost()); | 235 other_shell->web_contents()->GetRenderProcessHost()); |
235 } | 236 } |
236 | 237 |
237 } // namespace | 238 } // namespace |
238 } // namespace content | 239 } // namespace content |
OLD | NEW |