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

Side by Side Diff: chrome/browser/extensions/api/storage/settings_apitest.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 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 (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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/json/json_writer.h" 6 #include "base/json/json_writer.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" 10 #include "chrome/browser/extensions/api/storage/settings_sync_util.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 CreateMessage(settings_namespace, normal_action, is_final_action)); 167 CreateMessage(settings_namespace, normal_action, is_final_action));
168 listener_incognito.Reply( 168 listener_incognito.Reply(
169 CreateMessage(settings_namespace, incognito_action, is_final_action)); 169 CreateMessage(settings_namespace, incognito_action, is_final_action));
170 return extension; 170 return extension;
171 } 171 }
172 172
173 std::string CreateMessage( 173 std::string CreateMessage(
174 Namespace settings_namespace, 174 Namespace settings_namespace,
175 const std::string& action, 175 const std::string& action,
176 bool is_final_action) { 176 bool is_final_action) {
177 scoped_ptr<base::DictionaryValue> message(new base::DictionaryValue()); 177 base::DictionaryValue message;
178 message->SetString("namespace", ToString(settings_namespace)); 178 message.SetString("namespace", ToString(settings_namespace));
179 message->SetString("action", action); 179 message.SetString("action", action);
180 message->SetBoolean("isFinalAction", is_final_action); 180 message.SetBoolean("isFinalAction", is_final_action);
181 std::string message_json; 181 std::string message_json;
182 base::JSONWriter::Write(message.get(), &message_json); 182 base::JSONWriter::Write(message, &message_json);
183 return message_json; 183 return message_json;
184 } 184 }
185 185
186 void InitSyncWithSyncableService( 186 void InitSyncWithSyncableService(
187 syncer::SyncChangeProcessor* sync_processor, 187 syncer::SyncChangeProcessor* sync_processor,
188 syncer::SyncableService* settings_service) { 188 syncer::SyncableService* settings_service) {
189 EXPECT_FALSE( 189 EXPECT_FALSE(
190 settings_service->MergeDataAndStartSyncing( 190 settings_service->MergeDataAndStartSyncing(
191 kModelType, 191 kModelType,
192 syncer::SyncDataList(), 192 syncer::SyncDataList(),
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 // ENABLE_CONFIGURATION_POLICY is not defined. 572 // ENABLE_CONFIGURATION_POLICY is not defined.
573 StorageFrontend* frontend = StorageFrontend::Get(browser()->profile()); 573 StorageFrontend* frontend = StorageFrontend::Get(browser()->profile());
574 frontend->DisableStorageForTesting(MANAGED); 574 frontend->DisableStorageForTesting(MANAGED);
575 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); 575 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED));
576 // Now run the extension. 576 // Now run the extension.
577 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled")) 577 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled"))
578 << message_; 578 << message_;
579 } 579 }
580 580
581 } // namespace extensions 581 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698