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

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

Issue 1005303003: Split the aggregate dictionary of content settings exceptions into per-type dictionaries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 "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 25 matching lines...) Expand all
36 using ::testing::_; 36 using ::testing::_;
37 37
38 namespace content_settings { 38 namespace content_settings {
39 39
40 class DeadlockCheckerThread : public base::PlatformThread::Delegate { 40 class DeadlockCheckerThread : public base::PlatformThread::Delegate {
41 public: 41 public:
42 explicit DeadlockCheckerThread(PrefProvider* provider) 42 explicit DeadlockCheckerThread(PrefProvider* provider)
43 : provider_(provider) {} 43 : provider_(provider) {}
44 44
45 void ThreadMain() override { 45 void ThreadMain() override {
46 bool got_lock = provider_->content_settings_pref()->lock_.Try(); 46 EXPECT_TRUE(provider_->TestAllLocks());
47 EXPECT_TRUE(got_lock);
48 if (got_lock)
49 provider_->content_settings_pref()->lock_.Release();
50 } 47 }
51 private: 48 private:
52 PrefProvider* provider_; 49 PrefProvider* provider_;
53 DISALLOW_COPY_AND_ASSIGN(DeadlockCheckerThread); 50 DISALLOW_COPY_AND_ASSIGN(DeadlockCheckerThread);
54 }; 51 };
55 52
56 // A helper for observing an preference changes and testing whether 53 // A helper for observing an preference changes and testing whether
57 // |PrefProvider| holds a lock when the preferences change. 54 // |PrefProvider| holds a lock when the preferences change.
58 class DeadlockCheckerObserver { 55 class DeadlockCheckerObserver {
59 public: 56 public:
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 base::Time second = pref_content_settings_provider.GetLastUsage( 456 base::Time second = pref_content_settings_provider.GetLastUsage(
460 pattern, pattern, CONTENT_SETTINGS_TYPE_GEOLOCATION); 457 pattern, pattern, CONTENT_SETTINGS_TYPE_GEOLOCATION);
461 458
462 base::TimeDelta delta = second - first; 459 base::TimeDelta delta = second - first;
463 EXPECT_EQ(delta.InSeconds(), 10); 460 EXPECT_EQ(delta.InSeconds(), 10);
464 461
465 pref_content_settings_provider.ShutdownOnUIThread(); 462 pref_content_settings_provider.ShutdownOnUIThread();
466 } 463 }
467 464
468 } // namespace content_settings 465 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698