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

Side by Side Diff: chrome/browser/background/background_contents_service_unittest.cc

Issue 10834004: Correct const accessors in base/values.(h|cc) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reverting webdriver:Command::parameters_ to const Created 8 years, 5 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) 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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 22 matching lines...) Expand all
33 33
34 const DictionaryValue* GetPrefs(Profile* profile) { 34 const DictionaryValue* GetPrefs(Profile* profile) {
35 return profile->GetPrefs()->GetDictionary( 35 return profile->GetPrefs()->GetDictionary(
36 prefs::kRegisteredBackgroundContents); 36 prefs::kRegisteredBackgroundContents);
37 } 37 }
38 38
39 // Returns the stored pref URL for the passed app id. 39 // Returns the stored pref URL for the passed app id.
40 std::string GetPrefURLForApp(Profile* profile, const string16& appid) { 40 std::string GetPrefURLForApp(Profile* profile, const string16& appid) {
41 const DictionaryValue* pref = GetPrefs(profile); 41 const DictionaryValue* pref = GetPrefs(profile);
42 EXPECT_TRUE(pref->HasKey(UTF16ToUTF8(appid))); 42 EXPECT_TRUE(pref->HasKey(UTF16ToUTF8(appid)));
43 DictionaryValue* value; 43 const DictionaryValue* value;
44 pref->GetDictionaryWithoutPathExpansion(UTF16ToUTF8(appid), &value); 44 pref->GetDictionaryWithoutPathExpansion(UTF16ToUTF8(appid), &value);
45 std::string url; 45 std::string url;
46 value->GetString("url", &url); 46 value->GetString("url", &url);
47 return url; 47 return url;
48 } 48 }
49 49
50 scoped_ptr<CommandLine> command_line_; 50 scoped_ptr<CommandLine> command_line_;
51 }; 51 };
52 52
53 class MockBackgroundContents : public BackgroundContents { 53 class MockBackgroundContents : public BackgroundContents {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 contents->Navigate(url); 226 contents->Navigate(url);
227 EXPECT_EQ(1U, GetPrefs(&profile)->size()); 227 EXPECT_EQ(1U, GetPrefs(&profile)->size());
228 contents2->Navigate(url2); 228 contents2->Navigate(url2);
229 EXPECT_EQ(2U, GetPrefs(&profile)->size()); 229 EXPECT_EQ(2U, GetPrefs(&profile)->size());
230 service.ShutdownAssociatedBackgroundContents(ASCIIToUTF16("appid")); 230 service.ShutdownAssociatedBackgroundContents(ASCIIToUTF16("appid"));
231 EXPECT_FALSE(service.IsTracked(contents)); 231 EXPECT_FALSE(service.IsTracked(contents));
232 EXPECT_EQ(NULL, service.GetAppBackgroundContents(ASCIIToUTF16("appid"))); 232 EXPECT_EQ(NULL, service.GetAppBackgroundContents(ASCIIToUTF16("appid")));
233 EXPECT_EQ(1U, GetPrefs(&profile)->size()); 233 EXPECT_EQ(1U, GetPrefs(&profile)->size());
234 EXPECT_EQ(url2.spec(), GetPrefURLForApp(&profile, contents2->appid())); 234 EXPECT_EQ(url2.spec(), GetPrefURLForApp(&profile, contents2->appid()));
235 } 235 }
OLDNEW
« no previous file with comments | « chrome/browser/background/background_contents_service.cc ('k') | chrome/browser/bookmarks/bookmark_codec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698