Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: chrome/test/ui/javascript_test_util.cc

Issue 1120006: detect preferences errors (Closed)
Patch Set: changes from review Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/test/ui/dom_checker_uitest.cc ('k') | chrome/test/ui/ui_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/test/ui/javascript_test_util.h" 5 #include "chrome/test/ui/javascript_test_util.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/common/json_value_serializer.h" 11 #include "chrome/common/json_value_serializer.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 bool JsonDictionaryToMap(const std::string& json, 14 bool JsonDictionaryToMap(const std::string& json,
15 std::map<std::string, std::string>* results) { 15 std::map<std::string, std::string>* results) {
16 DCHECK(results != NULL); 16 DCHECK(results != NULL);
17 JSONStringValueSerializer deserializer(json); 17 JSONStringValueSerializer deserializer(json);
18 scoped_ptr<Value> root(deserializer.Deserialize(NULL)); 18 scoped_ptr<Value> root(deserializer.Deserialize(NULL, NULL));
19 19
20 // Note that we don't use ASSERT_TRUE here (and in some other places) as it 20 // Note that we don't use ASSERT_TRUE here (and in some other places) as it
21 // doesn't work inside a function with a return type other than void. 21 // doesn't work inside a function with a return type other than void.
22 EXPECT_TRUE(root.get()); 22 EXPECT_TRUE(root.get());
23 if (!root.get()) 23 if (!root.get())
24 return false; 24 return false;
25 25
26 EXPECT_TRUE(root->IsType(Value::TYPE_DICTIONARY)); 26 EXPECT_TRUE(root->IsType(Value::TYPE_DICTIONARY));
27 if (!root->IsType(Value::TYPE_DICTIONARY)) 27 if (!root->IsType(Value::TYPE_DICTIONARY))
28 return false; 28 return false;
(...skipping 17 matching lines...) Expand all
46 succeeded = value->GetAsString(&result); 46 succeeded = value->GetAsString(&result);
47 EXPECT_TRUE(succeeded); 47 EXPECT_TRUE(succeeded);
48 48
49 if (succeeded) 49 if (succeeded)
50 results->insert(std::make_pair(key, result)); 50 results->insert(std::make_pair(key, result));
51 } 51 }
52 } 52 }
53 53
54 return true; 54 return true;
55 } 55 }
OLDNEW
« no previous file with comments | « chrome/test/ui/dom_checker_uitest.cc ('k') | chrome/test/ui/ui_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698