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

Side by Side Diff: content/browser/mojo_sandbox_browsertest.cc

Issue 2766263009: Convert content ConnectionFilter to OnBindInterface (Closed)
Patch Set: . Created 3 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <stdint.h> 5 #include <stdint.h>
6 #include <memory> 6 #include <memory>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 void StopUtilityProcessOnIoThread() { host_.reset(); } 57 void StopUtilityProcessOnIoThread() { host_.reset(); }
58 58
59 DISALLOW_COPY_AND_ASSIGN(MojoSandboxTest); 59 DISALLOW_COPY_AND_ASSIGN(MojoSandboxTest);
60 }; 60 };
61 61
62 IN_PROC_BROWSER_TEST_F(MojoSandboxTest, SubprocessSharedBuffer) { 62 IN_PROC_BROWSER_TEST_F(MojoSandboxTest, SubprocessSharedBuffer) {
63 // Ensures that a shared buffer can be created within a sandboxed process. 63 // Ensures that a shared buffer can be created within a sandboxed process.
64 64
65 mojom::TestServicePtr test_service; 65 mojom::TestServicePtr test_service;
66 host_->GetRemoteInterfaces()->GetInterface(&test_service); 66 BindInterface(host_.get(), &test_service);
67 67
68 bool got_response = false; 68 bool got_response = false;
69 base::RunLoop run_loop; 69 base::RunLoop run_loop;
70 test_service.set_connection_error_handler(run_loop.QuitClosure()); 70 test_service.set_connection_error_handler(run_loop.QuitClosure());
71 test_service->CreateSharedBuffer( 71 test_service->CreateSharedBuffer(
72 kTestMessage, 72 kTestMessage,
73 base::Bind( 73 base::Bind(
74 [](const base::Closure& quit_closure, bool* got_response, 74 [](const base::Closure& quit_closure, bool* got_response,
75 mojo::ScopedSharedBufferHandle buffer) { 75 mojo::ScopedSharedBufferHandle buffer) {
76 ASSERT_TRUE(buffer.is_valid()); 76 ASSERT_TRUE(buffer.is_valid());
77 mojo::ScopedSharedBufferMapping mapping = 77 mojo::ScopedSharedBufferMapping mapping =
78 buffer->Map(kTestMessage.size()); 78 buffer->Map(kTestMessage.size());
79 ASSERT_TRUE(mapping); 79 ASSERT_TRUE(mapping);
80 std::string contents(static_cast<const char*>(mapping.get()), 80 std::string contents(static_cast<const char*>(mapping.get()),
81 kTestMessage.size()); 81 kTestMessage.size());
82 EXPECT_EQ(kTestMessage, contents); 82 EXPECT_EQ(kTestMessage, contents);
83 *got_response = true; 83 *got_response = true;
84 quit_closure.Run(); 84 quit_closure.Run();
85 }, 85 },
86 run_loop.QuitClosure(), &got_response)); 86 run_loop.QuitClosure(), &got_response));
87 run_loop.Run(); 87 run_loop.Run();
88 EXPECT_TRUE(got_response); 88 EXPECT_TRUE(got_response);
89 } 89 }
90 90
91 } // namespace 91 } // namespace
92 } // namespace content 92 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host_ui_shim.cc ('k') | content/browser/renderer_host/render_process_host_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698