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

Side by Side Diff: components/safe_json/testing_json_parser_unittest.cc

Issue 1921923002: Convert //components/[o-t]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/safe_json/testing_json_parser.h" 5 #include "components/safe_json/testing_json_parser.h"
6 6
7 #include <memory>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 12 #include "base/run_loop.h"
11 #include "base/values.h" 13 #include "base/values.h"
12 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
13 15
14 namespace safe_json { 16 namespace safe_json {
15 namespace { 17 namespace {
16 18
(...skipping 10 matching lines...) Expand all
27 run_loop.QuitClosure())); 29 run_loop.QuitClosure()));
28 run_loop.Run(); 30 run_loop.Run();
29 } 31 }
30 32
31 bool did_success() { return did_success_; } 33 bool did_success() { return did_success_; }
32 bool did_error() { return did_error_; } 34 bool did_error() { return did_error_; }
33 35
34 private: 36 private:
35 static void SuccessCallback(TestingJsonParserTest* test, 37 static void SuccessCallback(TestingJsonParserTest* test,
36 base::Closure quit_closure, 38 base::Closure quit_closure,
37 scoped_ptr<base::Value> value) { 39 std::unique_ptr<base::Value> value) {
38 test->did_success_ = true; 40 test->did_success_ = true;
39 quit_closure.Run(); 41 quit_closure.Run();
40 42
41 ASSERT_TRUE(value->IsType(base::Value::TYPE_DICTIONARY)); 43 ASSERT_TRUE(value->IsType(base::Value::TYPE_DICTIONARY));
42 base::DictionaryValue* dict; 44 base::DictionaryValue* dict;
43 ASSERT_TRUE(value->GetAsDictionary(&dict)); 45 ASSERT_TRUE(value->GetAsDictionary(&dict));
44 int key_value = 0; 46 int key_value = 0;
45 EXPECT_TRUE(dict->GetInteger("key", &key_value)); 47 EXPECT_TRUE(dict->GetInteger("key", &key_value));
46 EXPECT_EQ(2, key_value); 48 EXPECT_EQ(2, key_value);
47 } 49 }
(...skipping 20 matching lines...) Expand all
68 } 70 }
69 71
70 TEST_F(TestingJsonParserTest, QuitLoopInErrorCallback) { 72 TEST_F(TestingJsonParserTest, QuitLoopInErrorCallback) {
71 Parse(&kTestJson[1]); 73 Parse(&kTestJson[1]);
72 EXPECT_FALSE(did_success()); 74 EXPECT_FALSE(did_success());
73 EXPECT_TRUE(did_error()); 75 EXPECT_TRUE(did_error());
74 } 76 }
75 77
76 } // namespace 78 } // namespace
77 } // namespace safe_json 79 } // namespace safe_json
OLDNEW
« no previous file with comments | « components/safe_json/testing_json_parser.cc ('k') | components/search/search_android_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698