OLD | NEW |
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 <map> | 5 #include <map> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "components/leveldb/public/cpp/remote_iterator.h" | 8 #include "components/leveldb/public/cpp/remote_iterator.h" |
9 #include "components/leveldb/public/interfaces/leveldb.mojom.h" | 9 #include "components/leveldb/public/interfaces/leveldb.mojom.h" |
10 #include "mojo/common/common_type_converters.h" | 10 #include "mojo/common/common_type_converters.h" |
11 #include "mojo/util/capture_util.h" | |
12 #include "services/shell/public/cpp/shell_connection.h" | 11 #include "services/shell/public/cpp/shell_connection.h" |
13 #include "services/shell/public/cpp/shell_test.h" | 12 #include "services/shell/public/cpp/shell_test.h" |
14 | 13 |
15 using mojo::Capture; | |
16 | |
17 namespace leveldb { | 14 namespace leveldb { |
18 namespace { | 15 namespace { |
19 | 16 |
| 17 template <typename T1> |
| 18 mojo::Callback<void(T1)> Capture(T1* t1) { |
| 19 return [t1](T1 got_t1) { *t1 = std::move(got_t1); }; |
| 20 } |
| 21 |
20 class RemoteIteratorTest : public shell::test::ShellTest { | 22 class RemoteIteratorTest : public shell::test::ShellTest { |
21 public: | 23 public: |
22 RemoteIteratorTest() : ShellTest("exe:leveldb_service_unittests") {} | 24 RemoteIteratorTest() : ShellTest("exe:leveldb_service_unittests") {} |
23 ~RemoteIteratorTest() override {} | 25 ~RemoteIteratorTest() override {} |
24 | 26 |
25 protected: | 27 protected: |
26 // Overridden from mojo::test::ApplicationTestBase: | 28 // Overridden from mojo::test::ApplicationTestBase: |
27 void SetUp() override { | 29 void SetUp() override { |
28 ShellTest::SetUp(); | 30 ShellTest::SetUp(); |
29 connector()->ConnectToInterface("mojo:leveldb", &leveldb_); | 31 connector()->ConnectToInterface("mojo:leveldb", &leveldb_); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 EXPECT_TRUE(it.Valid()); | 139 EXPECT_TRUE(it.Valid()); |
138 EXPECT_EQ("a", it.key()); | 140 EXPECT_EQ("a", it.key()); |
139 EXPECT_EQ("first", it.value()); | 141 EXPECT_EQ("first", it.value()); |
140 | 142 |
141 it.Prev(); | 143 it.Prev(); |
142 EXPECT_FALSE(it.Valid()); | 144 EXPECT_FALSE(it.Valid()); |
143 } | 145 } |
144 | 146 |
145 } // namespace | 147 } // namespace |
146 } // namespace leveldb | 148 } // namespace leveldb |
OLD | NEW |