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