Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Contains code shared by all browsing data browsertests. | |
| 6 | |
| 7 #ifndef CHROME_BROWSER_BROWSING_DATA_HELPER_BROWSERTEST_H_ | |
| 8 #define CHROME_BROWSER_BROWSING_DATA_HELPER_BROWSERTEST_H_ | |
| 9 #pragma once | |
| 10 | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "base/basictypes.h" | |
| 14 #include "base/message_loop.h" | |
| 15 | |
| 16 // This template can be used for the StartFetching methods of the browsing data | |
| 17 // helper classes. It is supposed to be instantiated with the respective browsin g | |
| 18 // data info type. | |
| 19 template <typename T> | |
| 20 class BrowsingDataHelperCallback { | |
| 21 public: | |
| 22 BrowsingDataHelperCallback() {} | |
| 23 | |
| 24 const std::vector<T>& result() | |
| 25 { | |
| 26 MessageLoop::current()->Run(); | |
|
Bernhard Bauer
2011/02/10 12:52:19
Maybe you could DCHECK that |result_| was actually
| |
| 27 return result_; | |
| 28 } | |
| 29 | |
| 30 void callback(const std::vector<T>& info) { | |
| 31 result_ = info; | |
| 32 MessageLoop::current()->Quit(); | |
| 33 } | |
| 34 | |
| 35 private: | |
| 36 std::vector<T> result_; | |
| 37 | |
| 38 DISALLOW_COPY_AND_ASSIGN(BrowsingDataHelperCallback); | |
| 39 }; | |
| 40 | |
| 41 #endif // CHROME_BROWSER_BROWSING_DATA_HELPER_BROWSERTEST_H_ | |
| OLD | NEW |