| 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 "extensions/browser/mojo/stash_backend.h" | 5 #include "extensions/browser/mojo/stash_backend.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 ASSERT_TRUE(!stashed_objects.is_null()); | 184 ASSERT_TRUE(!stashed_objects.is_null()); |
| 185 EXPECT_EQ(0u, stashed_objects.size()); | 185 EXPECT_EQ(0u, stashed_objects.size()); |
| 186 } | 186 } |
| 187 | 187 |
| 188 TEST_F(StashServiceTest, NotifyOnReadableHandle) { | 188 TEST_F(StashServiceTest, NotifyOnReadableHandle) { |
| 189 mojo::Array<StashedObjectPtr> stash_entries; | 189 mojo::Array<StashedObjectPtr> stash_entries; |
| 190 StashedObjectPtr stashed_object(StashedObject::New()); | 190 StashedObjectPtr stashed_object(StashedObject::New()); |
| 191 stashed_object->id = "test type"; | 191 stashed_object->id = "test type"; |
| 192 stashed_object->data.push_back(0); | 192 stashed_object->data.push_back(0); |
| 193 stashed_object->monitor_handles = true; | 193 stashed_object->monitor_handles = true; |
| 194 mojo::InterfaceProviderPtr service_provider; | 194 mojo::shell::mojom::InterfaceProviderPtr service_provider; |
| 195 | 195 |
| 196 // Stash the ServiceProvider request. When we make a call on | 196 // Stash the ServiceProvider request. When we make a call on |
| 197 // |service_provider|, the stashed handle will become readable. | 197 // |service_provider|, the stashed handle will become readable. |
| 198 stashed_object->stashed_handles.push_back(mojo::ScopedHandle::From( | 198 stashed_object->stashed_handles.push_back(mojo::ScopedHandle::From( |
| 199 mojo::GetProxy(&service_provider).PassMessagePipe())); | 199 mojo::GetProxy(&service_provider).PassMessagePipe())); |
| 200 | 200 |
| 201 stash_entries.push_back(std::move(stashed_object)); | 201 stash_entries.push_back(std::move(stashed_object)); |
| 202 stash_service_->AddToStash(std::move(stash_entries)); | 202 stash_service_->AddToStash(std::move(stash_entries)); |
| 203 | 203 |
| 204 mojo::MessagePipe pipe; | 204 mojo::MessagePipe pipe; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 ASSERT_EQ(0u, stashed_objects.size()); | 292 ASSERT_EQ(0u, stashed_objects.size()); |
| 293 // Check that the stashed handle has been closed. | 293 // Check that the stashed handle has been closed. |
| 294 MojoResult result = | 294 MojoResult result = |
| 295 mojo::Wait(message_pipe.handle1.get(), | 295 mojo::Wait(message_pipe.handle1.get(), |
| 296 MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_READABLE, | 296 MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_READABLE, |
| 297 MOJO_DEADLINE_INDEFINITE, nullptr); | 297 MOJO_DEADLINE_INDEFINITE, nullptr); |
| 298 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result); | 298 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result); |
| 299 } | 299 } |
| 300 | 300 |
| 301 } // namespace extensions | 301 } // namespace extensions |
| OLD | NEW |