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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "extensions/browser/mojo/stash_backend.h" | 8 #include "extensions/browser/mojo/stash_backend.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace extensions { | 11 namespace extensions { |
12 | 12 |
13 class StashServiceTest : public testing::Test, public mojo::ErrorHandler { | 13 class StashServiceTest : public testing::Test, public mojo::ErrorHandler { |
14 public: | 14 public: |
15 enum Event { | 15 enum Event { |
16 EVENT_NONE, | 16 EVENT_NONE, |
17 EVENT_STASH_RETRIEVED, | 17 EVENT_STASH_RETRIEVED, |
18 }; | 18 }; |
19 | 19 |
20 StashServiceTest() {} | 20 StashServiceTest() {} |
21 | 21 |
22 virtual void SetUp() override { | 22 void SetUp() override { |
23 expecting_error_ = false; | 23 expecting_error_ = false; |
24 expected_event_ = EVENT_NONE; | 24 expected_event_ = EVENT_NONE; |
25 stash_backend_.reset(new StashBackend); | 25 stash_backend_.reset(new StashBackend); |
26 stash_backend_->BindToRequest(mojo::GetProxy(&stash_service_)); | 26 stash_backend_->BindToRequest(mojo::GetProxy(&stash_service_)); |
27 stash_service_.set_error_handler(this); | 27 stash_service_.set_error_handler(this); |
28 } | 28 } |
29 | 29 |
30 void OnConnectionError() override { FAIL() << "Unexpected connection error"; } | 30 void OnConnectionError() override { FAIL() << "Unexpected connection error"; } |
31 | 31 |
32 mojo::Array<StashedObjectPtr> RetrieveStash() { | 32 mojo::Array<StashedObjectPtr> RetrieveStash() { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 ASSERT_EQ(0u, stashed_objects.size()); | 165 ASSERT_EQ(0u, stashed_objects.size()); |
166 // Check that the stashed handle has been closed. | 166 // Check that the stashed handle has been closed. |
167 MojoResult result = | 167 MojoResult result = |
168 mojo::Wait(message_pipe.handle1.get(), | 168 mojo::Wait(message_pipe.handle1.get(), |
169 MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_READABLE, | 169 MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_READABLE, |
170 MOJO_DEADLINE_INDEFINITE); | 170 MOJO_DEADLINE_INDEFINITE); |
171 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result); | 171 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result); |
172 } | 172 } |
173 | 173 |
174 } // namespace extensions | 174 } // namespace extensions |
OLD | NEW |