OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/extension_function_test_utils.h" | 5 #include "chrome/browser/extensions/extension_function_test_utils.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 Browser* browser_; | 39 Browser* browser_; |
40 }; | 40 }; |
41 | 41 |
42 } // namespace | 42 } // namespace |
43 | 43 |
44 namespace extension_function_test_utils { | 44 namespace extension_function_test_utils { |
45 | 45 |
46 base::Value* ParseJSON(const std::string& data) { | 46 base::Value* ParseJSON(const std::string& data) { |
47 const bool kAllowTrailingComma = false; | 47 return base::JSONReader::Read(data); |
48 return base::JSONReader::Read(data, kAllowTrailingComma); | |
49 } | 48 } |
50 | 49 |
51 base::ListValue* ParseList(const std::string& data) { | 50 base::ListValue* ParseList(const std::string& data) { |
52 scoped_ptr<base::Value> result(ParseJSON(data)); | 51 scoped_ptr<base::Value> result(ParseJSON(data)); |
53 if (result.get() && result->IsType(base::Value::TYPE_LIST)) | 52 if (result.get() && result->IsType(base::Value::TYPE_LIST)) |
54 return static_cast<base::ListValue*>(result.release()); | 53 return static_cast<base::ListValue*>(result.release()); |
55 else | 54 else |
56 return NULL; | 55 return NULL; |
57 } | 56 } |
58 | 57 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 if (!response_delegate.HasResponse()) { | 207 if (!response_delegate.HasResponse()) { |
209 response_delegate.set_should_post_quit(true); | 208 response_delegate.set_should_post_quit(true); |
210 ui_test_utils::RunMessageLoop(); | 209 ui_test_utils::RunMessageLoop(); |
211 } | 210 } |
212 | 211 |
213 EXPECT_TRUE(response_delegate.HasResponse()); | 212 EXPECT_TRUE(response_delegate.HasResponse()); |
214 return response_delegate.GetResponse(); | 213 return response_delegate.GetResponse(); |
215 } | 214 } |
216 | 215 |
217 } // namespace extension_function_test_utils | 216 } // namespace extension_function_test_utils |
OLD | NEW |