| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "components/leveldb/public/cpp/remote_iterator.h" | 10 #include "components/leveldb/public/cpp/remote_iterator.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 class RemoteIteratorTest : public shell::test::ServiceTest { | 33 class RemoteIteratorTest : public shell::test::ServiceTest { |
| 34 public: | 34 public: |
| 35 RemoteIteratorTest() : ServiceTest("exe:leveldb_service_unittests") {} | 35 RemoteIteratorTest() : ServiceTest("exe:leveldb_service_unittests") {} |
| 36 ~RemoteIteratorTest() override {} | 36 ~RemoteIteratorTest() override {} |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 // Overridden from mojo::test::ApplicationTestBase: | 39 // Overridden from mojo::test::ApplicationTestBase: |
| 40 void SetUp() override { | 40 void SetUp() override { |
| 41 ServiceTest::SetUp(); | 41 ServiceTest::SetUp(); |
| 42 connector()->ConnectToInterface("mojo:leveldb", &leveldb_); | 42 connector()->ConnectToInterface("service:leveldb", &leveldb_); |
| 43 | 43 |
| 44 mojom::DatabaseError error; | 44 mojom::DatabaseError error; |
| 45 base::RunLoop run_loop; | 45 base::RunLoop run_loop; |
| 46 leveldb()->OpenInMemory(GetProxy(&database_), | 46 leveldb()->OpenInMemory(GetProxy(&database_), |
| 47 Capture(&error, run_loop.QuitClosure())); | 47 Capture(&error, run_loop.QuitClosure())); |
| 48 run_loop.Run(); | 48 run_loop.Run(); |
| 49 EXPECT_EQ(mojom::DatabaseError::OK, error); | 49 EXPECT_EQ(mojom::DatabaseError::OK, error); |
| 50 | 50 |
| 51 std::map<std::string, std::string> data{ | 51 std::map<std::string, std::string> data{ |
| 52 {"a", "first"}, {"b:suffix", "second"}, {"c", "third"}}; | 52 {"a", "first"}, {"b:suffix", "second"}, {"c", "third"}}; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 EXPECT_TRUE(it.Valid()); | 157 EXPECT_TRUE(it.Valid()); |
| 158 EXPECT_EQ("a", it.key()); | 158 EXPECT_EQ("a", it.key()); |
| 159 EXPECT_EQ("first", it.value()); | 159 EXPECT_EQ("first", it.value()); |
| 160 | 160 |
| 161 it.Prev(); | 161 it.Prev(); |
| 162 EXPECT_FALSE(it.Valid()); | 162 EXPECT_FALSE(it.Valid()); |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace | 165 } // namespace |
| 166 } // namespace leveldb | 166 } // namespace leveldb |
| OLD | NEW |