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

Side by Side Diff: content/browser/webui/web_ui_mojo_browsertest.cc

Issue 424463003: Basic Mojo message header validation for JavaScript. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make claimRange() consistent with isValidRange() Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/webui/web_ui_data_source_impl.cc ('k') | content/content_resources.grd » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <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
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
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
OLDNEW
« no previous file with comments | « content/browser/webui/web_ui_data_source_impl.cc ('k') | content/content_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698