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.h" | 10 #include "base/message_loop.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "chrome/test/base/testing_pref_service.h" | 27 #include "chrome/test/base/testing_pref_service.h" |
28 #include "chrome/test/base/testing_profile.h" | 28 #include "chrome/test/base/testing_profile.h" |
29 #include "content/public/browser/notification_observer.h" | 29 #include "content/public/browser/notification_observer.h" |
30 #include "content/public/test/test_browser_thread.h" | 30 #include "content/public/test/test_browser_thread.h" |
31 #include "googleurl/src/gurl.h" | 31 #include "googleurl/src/gurl.h" |
32 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
33 | 33 |
34 using ::testing::_; | 34 using ::testing::_; |
35 using content::BrowserThread; | 35 using content::BrowserThread; |
36 | 36 |
37 namespace { | |
38 | |
39 void ExpectObsoleteGeolocationSetting( | |
40 const DictionaryValue& geo_settings_dictionary, | |
41 const GURL& primary_origin, | |
42 const GURL& secondary_origin, | |
43 ContentSetting expected_setting) { | |
44 | |
45 const DictionaryValue* one_origin_settings; | |
46 ASSERT_TRUE(geo_settings_dictionary.GetDictionaryWithoutPathExpansion( | |
47 std::string(primary_origin.spec()), &one_origin_settings)); | |
48 int setting_value; | |
49 ASSERT_TRUE(one_origin_settings->GetIntegerWithoutPathExpansion( | |
50 std::string(secondary_origin.spec()), &setting_value)); | |
51 EXPECT_EQ(expected_setting, setting_value); | |
52 } | |
53 | |
54 } // namespace | |
55 | |
56 namespace content_settings { | 37 namespace content_settings { |
57 | 38 |
58 class DeadlockCheckerThread : public base::PlatformThread::Delegate { | 39 class DeadlockCheckerThread : public base::PlatformThread::Delegate { |
59 public: | 40 public: |
60 explicit DeadlockCheckerThread(PrefProvider* provider) | 41 explicit DeadlockCheckerThread(PrefProvider* provider) |
61 : provider_(provider) {} | 42 : provider_(provider) {} |
62 | 43 |
63 virtual void ThreadMain() { | 44 virtual void ThreadMain() { |
64 bool got_lock = provider_->lock_.Try(); | 45 bool got_lock = provider_->lock_.Try(); |
65 EXPECT_TRUE(got_lock); | 46 EXPECT_TRUE(got_lock); |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 DictionaryValue* mutable_settings = update.Get(); | 571 DictionaryValue* mutable_settings = update.Get(); |
591 mutable_settings->SetWithoutPathExpansion("www.example.com,*", | 572 mutable_settings->SetWithoutPathExpansion("www.example.com,*", |
592 new base::DictionaryValue()); | 573 new base::DictionaryValue()); |
593 } | 574 } |
594 EXPECT_TRUE(observer.notification_received()); | 575 EXPECT_TRUE(observer.notification_received()); |
595 | 576 |
596 provider.ShutdownOnUIThread(); | 577 provider.ShutdownOnUIThread(); |
597 } | 578 } |
598 | 579 |
599 } // namespace content_settings | 580 } // namespace content_settings |
OLD | NEW |