| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // multiple embedded iframes, as notifications seem to be 'batched'. Instead, we | 48 // multiple embedded iframes, as notifications seem to be 'batched'. Instead, we |
| 49 // load and wait one single frame here by calling a javascript function. | 49 // load and wait one single frame here by calling a javascript function. |
| 50 class IFrameLoader : public content::NotificationObserver { | 50 class IFrameLoader : public content::NotificationObserver { |
| 51 public: | 51 public: |
| 52 IFrameLoader(Browser* browser, int iframe_id, const GURL& url); | 52 IFrameLoader(Browser* browser, int iframe_id, const GURL& url); |
| 53 virtual ~IFrameLoader(); | 53 virtual ~IFrameLoader(); |
| 54 | 54 |
| 55 // content::NotificationObserver: | 55 // content::NotificationObserver: |
| 56 virtual void Observe(int type, | 56 virtual void Observe(int type, |
| 57 const content::NotificationSource& source, | 57 const content::NotificationSource& source, |
| 58 const content::NotificationDetails& details) OVERRIDE; | 58 const content::NotificationDetails& details) override; |
| 59 | 59 |
| 60 const GURL& iframe_url() const { return iframe_url_; } | 60 const GURL& iframe_url() const { return iframe_url_; } |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 content::NotificationRegistrar registrar_; | 63 content::NotificationRegistrar registrar_; |
| 64 | 64 |
| 65 // If true the navigation has completed. | 65 // If true the navigation has completed. |
| 66 bool navigation_completed_; | 66 bool navigation_completed_; |
| 67 | 67 |
| 68 // If true the javascript call has completed. | 68 // If true the javascript call has completed. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 public: | 127 public: |
| 128 // If |wait_for_infobar| is true, AddWatchAndWaitForNotification will block | 128 // If |wait_for_infobar| is true, AddWatchAndWaitForNotification will block |
| 129 // until the infobar has been displayed; otherwise it will block until the | 129 // until the infobar has been displayed; otherwise it will block until the |
| 130 // navigation is completed. | 130 // navigation is completed. |
| 131 explicit GeolocationNotificationObserver(bool wait_for_infobar); | 131 explicit GeolocationNotificationObserver(bool wait_for_infobar); |
| 132 virtual ~GeolocationNotificationObserver(); | 132 virtual ~GeolocationNotificationObserver(); |
| 133 | 133 |
| 134 // content::NotificationObserver: | 134 // content::NotificationObserver: |
| 135 virtual void Observe(int type, | 135 virtual void Observe(int type, |
| 136 const content::NotificationSource& source, | 136 const content::NotificationSource& source, |
| 137 const content::NotificationDetails& details) OVERRIDE; | 137 const content::NotificationDetails& details) override; |
| 138 | 138 |
| 139 void AddWatchAndWaitForNotification( | 139 void AddWatchAndWaitForNotification( |
| 140 content::RenderFrameHost* render_frame_host); | 140 content::RenderFrameHost* render_frame_host); |
| 141 | 141 |
| 142 bool has_infobar() const { return !!infobar_; } | 142 bool has_infobar() const { return !!infobar_; } |
| 143 infobars::InfoBar* infobar() { return infobar_; } | 143 infobars::InfoBar* infobar() { return infobar_; } |
| 144 | 144 |
| 145 private: | 145 private: |
| 146 content::NotificationRegistrar registrar_; | 146 content::NotificationRegistrar registrar_; |
| 147 bool wait_for_infobar_; | 147 bool wait_for_infobar_; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 INITIALIZATION_NONE, | 238 INITIALIZATION_NONE, |
| 239 INITIALIZATION_OFFTHERECORD, | 239 INITIALIZATION_OFFTHERECORD, |
| 240 INITIALIZATION_NEWTAB, | 240 INITIALIZATION_NEWTAB, |
| 241 INITIALIZATION_IFRAMES, | 241 INITIALIZATION_IFRAMES, |
| 242 }; | 242 }; |
| 243 | 243 |
| 244 GeolocationBrowserTest(); | 244 GeolocationBrowserTest(); |
| 245 virtual ~GeolocationBrowserTest(); | 245 virtual ~GeolocationBrowserTest(); |
| 246 | 246 |
| 247 // InProcessBrowserTest: | 247 // InProcessBrowserTest: |
| 248 virtual void SetUpOnMainThread() OVERRIDE; | 248 virtual void SetUpOnMainThread() override; |
| 249 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; | 249 virtual void TearDownInProcessBrowserTestFixture() override; |
| 250 | 250 |
| 251 Browser* current_browser() { return current_browser_; } | 251 Browser* current_browser() { return current_browser_; } |
| 252 void set_html_for_tests(const std::string& html_for_tests) { | 252 void set_html_for_tests(const std::string& html_for_tests) { |
| 253 html_for_tests_ = html_for_tests; | 253 html_for_tests_ = html_for_tests; |
| 254 } | 254 } |
| 255 content::RenderFrameHost* frame_host() const { return render_frame_host_; } | 255 content::RenderFrameHost* frame_host() const { return render_frame_host_; } |
| 256 const GURL& current_url() const { return current_url_; } | 256 const GURL& current_url() const { return current_url_; } |
| 257 const GURL& iframe_url(size_t i) const { return iframe_urls_[i]; } | 257 const GURL& iframe_url(size_t i) const { return iframe_urls_[i]; } |
| 258 double fake_latitude() const { return fake_latitude_; } | 258 double fake_latitude() const { return fake_latitude_; } |
| 259 double fake_longitude() const { return fake_longitude_; } | 259 double fake_longitude() const { return fake_longitude_; } |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 // Last usage has been updated. | 809 // Last usage has been updated. |
| 810 EXPECT_EQ(current_browser() | 810 EXPECT_EQ(current_browser() |
| 811 ->profile() | 811 ->profile() |
| 812 ->GetHostContentSettingsMap() | 812 ->GetHostContentSettingsMap() |
| 813 ->GetLastUsage(current_url().GetOrigin(), | 813 ->GetLastUsage(current_url().GetOrigin(), |
| 814 current_url().GetOrigin(), | 814 current_url().GetOrigin(), |
| 815 CONTENT_SETTINGS_TYPE_GEOLOCATION) | 815 CONTENT_SETTINGS_TYPE_GEOLOCATION) |
| 816 .ToDoubleT(), | 816 .ToDoubleT(), |
| 817 13); | 817 13); |
| 818 } | 818 } |
| OLD | NEW |