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

Side by Side Diff: components/web_resource/promo_resource_service_mobile_ntp_unittest.cc

Issue 1323923002: Remove use of JSONReader::DeprecatedRead from components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Error fix Created 5 years, 3 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 (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 <vector> 5 #include <vector>
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/prefs/testing_pref_service.h" 9 #include "base/prefs/testing_pref_service.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 : local_state_(local_state), 45 : local_state_(local_state),
46 mobile_promo_(local_state), 46 mobile_promo_(local_state),
47 received_notification_(false) {} 47 received_notification_(false) {}
48 48
49 void Init(const std::string& json, 49 void Init(const std::string& json,
50 const std::string& promo_text, 50 const std::string& promo_text,
51 const std::string& promo_text_long, 51 const std::string& promo_text_long,
52 const std::string& promo_action_type, 52 const std::string& promo_action_type,
53 const std::string& promo_action_arg0, 53 const std::string& promo_action_arg0,
54 const std::string& promo_action_arg1) { 54 const std::string& promo_action_arg1) {
55 base::Value* value(base::JSONReader::DeprecatedRead(json)); 55 scoped_ptr<base::Value> value = base::JSONReader::Read(json);
56 ASSERT_TRUE(value); 56 ASSERT_TRUE(value);
57 base::DictionaryValue* dict = NULL; 57 base::DictionaryValue* dict = NULL;
58 value->GetAsDictionary(&dict); 58 value.release()->GetAsDictionary(&dict);
59 ASSERT_TRUE(dict); 59 ASSERT_TRUE(dict);
60 test_json_.reset(dict); 60 test_json_.reset(dict);
61 61
62 promo_text_ = promo_text; 62 promo_text_ = promo_text;
63 promo_text_long_ = promo_text_long; 63 promo_text_long_ = promo_text_long;
64 promo_action_type_ = promo_action_type; 64 promo_action_type_ = promo_action_type;
65 promo_action_args_.push_back(promo_action_arg0); 65 promo_action_args_.push_back(promo_action_arg0);
66 promo_action_args_.push_back(promo_action_arg1); 66 promo_action_args_.push_back(promo_action_arg1);
67 67
68 received_notification_ = false; 68 received_notification_ = false;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 promo_test.InitPromoFromJson(true); 177 promo_test.InitPromoFromJson(true);
178 178
179 // Second time should not trigger a notification. 179 // Second time should not trigger a notification.
180 promo_test.InitPromoFromJson(false); 180 promo_test.InitPromoFromJson(false);
181 181
182 promo_test.TestInitFromPrefs(); 182 promo_test.TestInitFromPrefs();
183 } 183 }
184 184
185 } // namespace web_resource 185 } // namespace web_resource
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698