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

Side by Side Diff: chrome/browser/content_settings/content_settings_pref_provider_unittest.cc

Issue 1323143008: Remove CONTENT_SETTINGS_NUM_TYPES (part 5) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-num-types-enum-2
Patch Set: 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
« no previous file with comments | « no previous file | components/content_settings/content/common/content_settings_messages.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) 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 "components/content_settings/core/browser/content_settings_pref_provide r.h" 5 #include "components/content_settings/core/browser/content_settings_pref_provide r.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.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/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // A helper for observing an preference changes and testing whether 58 // A helper for observing an preference changes and testing whether
59 // |PrefProvider| holds a lock when the preferences change. 59 // |PrefProvider| holds a lock when the preferences change.
60 class DeadlockCheckerObserver { 60 class DeadlockCheckerObserver {
61 public: 61 public:
62 // |DeadlockCheckerObserver| doesn't take the ownership of |prefs| or 62 // |DeadlockCheckerObserver| doesn't take the ownership of |prefs| or
63 // |provider|. 63 // |provider|.
64 DeadlockCheckerObserver(PrefService* prefs, PrefProvider* provider) 64 DeadlockCheckerObserver(PrefService* prefs, PrefProvider* provider)
65 : provider_(provider), 65 : provider_(provider),
66 notification_received_(false) { 66 notification_received_(false) {
67 pref_change_registrar_.Init(prefs); 67 pref_change_registrar_.Init(prefs);
68 for (ContentSettingsPref* pref : provider_->content_settings_prefs_) { 68 for (const auto& pair : provider_->content_settings_prefs_) {
69 const ContentSettingsPref* pref = pair.second;
69 pref_change_registrar_.Add( 70 pref_change_registrar_.Add(
70 pref->pref_name_, 71 pref->pref_name_,
71 base::Bind( 72 base::Bind(
72 &DeadlockCheckerObserver::OnContentSettingsPatternPairsChanged, 73 &DeadlockCheckerObserver::OnContentSettingsPatternPairsChanged,
73 base::Unretained(this), base::Unretained(pref))); 74 base::Unretained(this), base::Unretained(pref)));
74 } 75 }
75 } 76 }
76 virtual ~DeadlockCheckerObserver() {} 77 virtual ~DeadlockCheckerObserver() {}
77 78
78 bool notification_received() const { 79 bool notification_received() const {
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 for (const char* pref : nonempty_prefs) { 618 for (const char* pref : nonempty_prefs) {
618 DictionaryPrefUpdate update(&prefs, pref); 619 DictionaryPrefUpdate update(&prefs, pref);
619 const base::DictionaryValue* dictionary = update.Get(); 620 const base::DictionaryValue* dictionary = update.Get();
620 EXPECT_EQ(1u, dictionary->size()); 621 EXPECT_EQ(1u, dictionary->size());
621 } 622 }
622 623
623 provider.ShutdownOnUIThread(); 624 provider.ShutdownOnUIThread();
624 } 625 }
625 626
626 } // namespace content_settings 627 } // namespace content_settings
OLDNEW
« no previous file with comments | « no previous file | components/content_settings/content/common/content_settings_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698