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 #ifndef THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_STORAGE_TEST_RUNNER_H_ | 5 #ifndef THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_STORAGE_TEST_RUNNER_H_ |
6 #define THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_STORAGE_TEST_RUNNER_H_ | 6 #define THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_STORAGE_TEST_RUNNER_H_ |
7 | 7 |
8 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/storage.h" | 8 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/storage.h" |
9 | 9 |
| 10 #include <memory> |
10 #include <string> | 11 #include <string> |
11 | 12 |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 | 14 |
15 namespace autofill { | 15 namespace autofill { |
16 | 16 |
17 // A test sutie for ::i18n::addressinput::Storage. | 17 // A test sutie for ::i18n::addressinput::Storage. |
18 class StorageTestRunner { | 18 class StorageTestRunner { |
19 public: | 19 public: |
20 // Does not take ownership of |storage|. | 20 // Does not take ownership of |storage|. |
21 explicit StorageTestRunner(::i18n::addressinput::Storage* storage); | 21 explicit StorageTestRunner(::i18n::addressinput::Storage* storage); |
22 ~StorageTestRunner(); | 22 ~StorageTestRunner(); |
23 | 23 |
24 // Runs all the tests from the standard test suite. | 24 // Runs all the tests from the standard test suite. |
25 void RunAllTests(); | 25 void RunAllTests(); |
26 | 26 |
27 private: | 27 private: |
28 void ClearValues(); | 28 void ClearValues(); |
29 scoped_ptr< ::i18n::addressinput::Storage::Callback> BuildCallback(); | 29 std::unique_ptr<::i18n::addressinput::Storage::Callback> BuildCallback(); |
30 void OnDataReady(bool success, const std::string& key, std::string* data); | 30 void OnDataReady(bool success, const std::string& key, std::string* data); |
31 | 31 |
32 // Test suite. | 32 // Test suite. |
33 void GetWithoutPutReturnsEmptyData(); | 33 void GetWithoutPutReturnsEmptyData(); |
34 void GetReturnsWhatWasPut(); | 34 void GetReturnsWhatWasPut(); |
35 void SecondPutOverwritesData(); | 35 void SecondPutOverwritesData(); |
36 | 36 |
37 ::i18n::addressinput::Storage* storage_; // weak | 37 ::i18n::addressinput::Storage* storage_; // weak |
38 bool success_; | 38 bool success_; |
39 std::string key_; | 39 std::string key_; |
40 std::string data_; | 40 std::string data_; |
41 | 41 |
42 DISALLOW_COPY_AND_ASSIGN(StorageTestRunner); | 42 DISALLOW_COPY_AND_ASSIGN(StorageTestRunner); |
43 }; | 43 }; |
44 | 44 |
45 } // namespace autofill | 45 } // namespace autofill |
46 | 46 |
47 #endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_STORAGE_TEST_RUNNER_H_ | 47 #endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_STORAGE_TEST_RUNNER_H_ |
OLD | NEW |