| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 ~RemoteIteratorTest() override {} | 45 ~RemoteIteratorTest() override {} |
| 46 | 46 |
| 47 protected: | 47 protected: |
| 48 // Overridden from mojo::test::ApplicationTestBase: | 48 // Overridden from mojo::test::ApplicationTestBase: |
| 49 void SetUp() override { | 49 void SetUp() override { |
| 50 ServiceTest::SetUp(); | 50 ServiceTest::SetUp(); |
| 51 connector()->ConnectToInterface("leveldb", &leveldb_); | 51 connector()->ConnectToInterface("leveldb", &leveldb_); |
| 52 | 52 |
| 53 mojom::DatabaseError error; | 53 mojom::DatabaseError error; |
| 54 base::RunLoop run_loop; | 54 base::RunLoop run_loop; |
| 55 leveldb()->OpenInMemory(GetProxy(&database_), | 55 leveldb()->OpenInMemory(MakeRequest(&database_), |
| 56 Capture(&error, run_loop.QuitClosure())); | 56 Capture(&error, run_loop.QuitClosure())); |
| 57 run_loop.Run(); | 57 run_loop.Run(); |
| 58 EXPECT_EQ(mojom::DatabaseError::OK, error); | 58 EXPECT_EQ(mojom::DatabaseError::OK, error); |
| 59 | 59 |
| 60 std::map<std::string, std::string> data{ | 60 std::map<std::string, std::string> data{ |
| 61 {"a", "first"}, {"b:suffix", "second"}, {"c", "third"}}; | 61 {"a", "first"}, {"b:suffix", "second"}, {"c", "third"}}; |
| 62 | 62 |
| 63 for (auto p : data) { | 63 for (auto p : data) { |
| 64 // Write a key to the database. | 64 // Write a key to the database. |
| 65 error = mojom::DatabaseError::INVALID_ARGUMENT; | 65 error = mojom::DatabaseError::INVALID_ARGUMENT; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 EXPECT_TRUE(it.Valid()); | 166 EXPECT_TRUE(it.Valid()); |
| 167 EXPECT_EQ("a", it.key()); | 167 EXPECT_EQ("a", it.key()); |
| 168 EXPECT_EQ("first", it.value()); | 168 EXPECT_EQ("first", it.value()); |
| 169 | 169 |
| 170 it.Prev(); | 170 it.Prev(); |
| 171 EXPECT_FALSE(it.Valid()); | 171 EXPECT_FALSE(it.Valid()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace | 174 } // namespace |
| 175 } // namespace leveldb | 175 } // namespace leveldb |
| OLD | NEW |