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

Side by Side Diff: base/prefs/pref_member_unittest.cc

Issue 753603002: Change preference APIs to take std::string instead of const char*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed all calls to c_str() in prefs. Created 6 years 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 | « base/prefs/pref_member.cc ('k') | base/prefs/pref_notifier_impl.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/prefs/pref_member.h" 5 #include "base/prefs/pref_member.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/prefs/pref_registry_simple.h" 9 #include "base/prefs/pref_registry_simple.h"
10 #include "base/prefs/testing_pref_service.h" 10 #include "base/prefs/testing_pref_service.h"
(...skipping 17 matching lines...) Expand all
28 registry->RegisterListPref(kStringListPref, new base::ListValue()); 28 registry->RegisterListPref(kStringListPref, new base::ListValue());
29 } 29 }
30 30
31 class GetPrefValueHelper 31 class GetPrefValueHelper
32 : public base::RefCountedThreadSafe<GetPrefValueHelper> { 32 : public base::RefCountedThreadSafe<GetPrefValueHelper> {
33 public: 33 public:
34 GetPrefValueHelper() : value_(false), pref_thread_("pref thread") { 34 GetPrefValueHelper() : value_(false), pref_thread_("pref thread") {
35 pref_thread_.Start(); 35 pref_thread_.Start();
36 } 36 }
37 37
38 void Init(const char* pref_name, PrefService* prefs) { 38 void Init(const std::string& pref_name, PrefService* prefs) {
39 pref_.Init(pref_name, prefs); 39 pref_.Init(pref_name, prefs);
40 pref_.MoveToThread(pref_thread_.message_loop_proxy()); 40 pref_.MoveToThread(pref_thread_.message_loop_proxy());
41 } 41 }
42 42
43 void Destroy() { 43 void Destroy() {
44 pref_.Destroy(); 44 pref_.Destroy();
45 } 45 }
46 46
47 void FetchValue() { 47 void FetchValue() {
48 base::WaitableEvent event(true, false); 48 base::WaitableEvent event(true, false);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 helper->FetchValue(); 312 helper->FetchValue();
313 EXPECT_TRUE(helper->value()); 313 EXPECT_TRUE(helper->value());
314 314
315 helper->Destroy(); 315 helper->Destroy();
316 316
317 helper->FetchValue(); 317 helper->FetchValue();
318 EXPECT_TRUE(helper->value()); 318 EXPECT_TRUE(helper->value());
319 319
320 helper->StopThread(); 320 helper->StopThread();
321 } 321 }
OLDNEW
« no previous file with comments | « base/prefs/pref_member.cc ('k') | base/prefs/pref_notifier_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698