| OLD | NEW |
| 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/message_loop/message_loop.h" | |
| 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 9 #include "chrome/browser/geolocation/geolocation_settings_state.h" | 8 #include "chrome/browser/geolocation/geolocation_settings_state.h" |
| 10 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
| 11 #include "components/content_settings/core/browser/host_content_settings_map.h" | 10 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 12 #include "content/public/browser/navigation_details.h" | 11 #include "content/public/browser/navigation_details.h" |
| 13 #include "content/public/browser/navigation_entry.h" | 12 #include "content/public/browser/navigation_entry.h" |
| 14 #include "content/public/test/test_browser_thread.h" | 13 #include "content/public/test/test_browser_thread_bundle.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 15 |
| 17 using content::BrowserThread; | |
| 18 using content::NavigationEntry; | 16 using content::NavigationEntry; |
| 19 | 17 |
| 20 namespace { | 18 namespace { |
| 21 | 19 |
| 22 class GeolocationSettingsStateTests : public testing::Test { | 20 class GeolocationSettingsStateTests : public testing::Test { |
| 23 public: | 21 public: |
| 24 GeolocationSettingsStateTests() | 22 GeolocationSettingsStateTests() = default; |
| 25 : ui_thread_(BrowserThread::UI, &message_loop_) { | |
| 26 } | |
| 27 | 23 |
| 28 protected: | 24 protected: |
| 29 base::MessageLoop message_loop_; | 25 content::TestBrowserThreadBundle test_browser_thread_bundle_; |
| 30 content::TestBrowserThread ui_thread_; | |
| 31 }; | 26 }; |
| 32 | 27 |
| 33 TEST_F(GeolocationSettingsStateTests, ClearOnNewOrigin) { | 28 TEST_F(GeolocationSettingsStateTests, ClearOnNewOrigin) { |
| 34 TestingProfile profile; | 29 TestingProfile profile; |
| 35 GeolocationSettingsState state(&profile); | 30 GeolocationSettingsState state(&profile); |
| 36 GURL url_0("http://www.example.com"); | 31 GURL url_0("http://www.example.com"); |
| 37 | 32 |
| 38 std::unique_ptr<NavigationEntry> entry(NavigationEntry::Create()); | 33 std::unique_ptr<NavigationEntry> entry(NavigationEntry::Create()); |
| 39 entry->SetURL(url_0); | 34 entry->SetURL(url_0); |
| 40 content::LoadCommittedDetails load_committed_details; | 35 content::LoadCommittedDetails load_committed_details; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 formatted_host_per_state[CONTENT_SETTING_ALLOW].count( | 189 formatted_host_per_state[CONTENT_SETTING_ALLOW].count( |
| 195 url_2.host())); | 190 url_2.host())); |
| 196 EXPECT_EQ(1U, formatted_host_per_state[CONTENT_SETTING_BLOCK].size()); | 191 EXPECT_EQ(1U, formatted_host_per_state[CONTENT_SETTING_BLOCK].size()); |
| 197 EXPECT_EQ(1U, | 192 EXPECT_EQ(1U, |
| 198 formatted_host_per_state[CONTENT_SETTING_BLOCK].count( | 193 formatted_host_per_state[CONTENT_SETTING_BLOCK].count( |
| 199 url_1.spec())); | 194 url_1.spec())); |
| 200 } | 195 } |
| 201 | 196 |
| 202 | 197 |
| 203 } // namespace | 198 } // namespace |
| OLD | NEW |