OLD | NEW |
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 "chrome/browser/content_settings/content_settings_pref_provider.h" | 5 #include "chrome/browser/content_settings/content_settings_pref_provider.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 24 matching lines...) Expand all Loading... |
35 using ::testing::_; | 35 using ::testing::_; |
36 using content::BrowserThread; | 36 using content::BrowserThread; |
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 virtual void ThreadMain() override { | 45 void ThreadMain() override { |
46 bool got_lock = provider_->lock_.Try(); | 46 bool got_lock = provider_->lock_.Try(); |
47 EXPECT_TRUE(got_lock); | 47 EXPECT_TRUE(got_lock); |
48 if (got_lock) | 48 if (got_lock) |
49 provider_->lock_.Release(); | 49 provider_->lock_.Release(); |
50 } | 50 } |
51 private: | 51 private: |
52 PrefProvider* provider_; | 52 PrefProvider* provider_; |
53 DISALLOW_COPY_AND_ASSIGN(DeadlockCheckerThread); | 53 DISALLOW_COPY_AND_ASSIGN(DeadlockCheckerThread); |
54 }; | 54 }; |
55 | 55 |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 base::Time second = pref_content_settings_provider.GetLastUsage( | 470 base::Time second = pref_content_settings_provider.GetLastUsage( |
471 pattern, pattern, CONTENT_SETTINGS_TYPE_GEOLOCATION); | 471 pattern, pattern, CONTENT_SETTINGS_TYPE_GEOLOCATION); |
472 | 472 |
473 base::TimeDelta delta = second - first; | 473 base::TimeDelta delta = second - first; |
474 EXPECT_EQ(delta.InSeconds(), 10); | 474 EXPECT_EQ(delta.InSeconds(), 10); |
475 | 475 |
476 pref_content_settings_provider.ShutdownOnUIThread(); | 476 pref_content_settings_provider.ShutdownOnUIThread(); |
477 } | 477 } |
478 | 478 |
479 } // namespace content_settings | 479 } // namespace content_settings |
OLD | NEW |