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

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

Issue 411553003: Validate incoming JS Message Headers: test message parser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed WebUIMojoTest.EndToEndPing 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 22 matching lines...) Expand all
33 namespace content { 33 namespace content {
34 namespace { 34 namespace {
35 35
36 bool got_message = false; 36 bool got_message = false;
37 37
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::kCodecModuleName || 43 if (id == mojo::kBufferModuleName ||
44 id == mojo::kCodecModuleName ||
44 id == mojo::kConnectionModuleName || 45 id == mojo::kConnectionModuleName ||
45 id == mojo::kConnectorModuleName || 46 id == mojo::kConnectorModuleName ||
46 id == mojo::kUnicodeModuleName || 47 id == mojo::kUnicodeModuleName ||
47 id == mojo::kRouterModuleName) 48 id == mojo::kRouterModuleName)
48 return false; 49 return false;
49 50
50 std::string contents; 51 std::string contents;
51 CHECK(base::ReadFileToString(mojo::test::GetFilePathForJSResource(id), 52 CHECK(base::ReadFileToString(mojo::test::GetFilePathForJSResource(id),
52 &contents, 53 &contents,
53 std::string::npos)) << id; 54 std::string::npos)) << id;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 NavigateToURL(other_shell, test_url); 232 NavigateToURL(other_shell, test_url);
232 // RunLoop is quit when message received from page. 233 // RunLoop is quit when message received from page.
233 other_run_loop.Run(); 234 other_run_loop.Run();
234 EXPECT_TRUE(got_message); 235 EXPECT_TRUE(got_message);
235 EXPECT_EQ(shell()->web_contents()->GetRenderProcessHost(), 236 EXPECT_EQ(shell()->web_contents()->GetRenderProcessHost(),
236 other_shell->web_contents()->GetRenderProcessHost()); 237 other_shell->web_contents()->GetRenderProcessHost());
237 } 238 }
238 239
239 } // namespace 240 } // namespace
240 } // namespace content 241 } // 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