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

Side by Side Diff: chrome/browser/geolocation/geolocation_browsertest.cc

Issue 2371113003: Do not give instant focus if a view's toplevelwidget is not active (Closed)
Patch Set: new patch Created 4 years, 2 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/test/simple_test_clock.h" 14 #include "base/test/simple_test_clock.h"
15 #include "base/time/clock.h" 15 #include "base/time/clock.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "chrome/browser/chrome_notification_types.h" 17 #include "chrome/browser/chrome_notification_types.h"
18 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 18 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
19 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 19 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
20 #include "chrome/browser/permissions/permission_request_manager.h" 20 #include "chrome/browser/permissions/permission_request_manager.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_commands.h" 23 #include "chrome/browser/ui/browser_commands.h"
24 #include "chrome/browser/ui/tabs/tab_strip_model.h" 24 #include "chrome/browser/ui/tabs/tab_strip_model.h"
25 #include "chrome/test/base/in_process_browser_test.h" 25 #include "chrome/test/base/in_process_browser_test.h"
26 #include "chrome/test/base/interactive_test_utils.h"
26 #include "chrome/test/base/ui_test_utils.h" 27 #include "chrome/test/base/ui_test_utils.h"
27 #include "components/content_settings/core/browser/content_settings_usages_state .h" 28 #include "components/content_settings/core/browser/content_settings_usages_state .h"
28 #include "components/content_settings/core/browser/host_content_settings_map.h" 29 #include "components/content_settings/core/browser/host_content_settings_map.h"
29 #include "content/public/browser/navigation_controller.h" 30 #include "content/public/browser/navigation_controller.h"
30 #include "content/public/browser/notification_details.h" 31 #include "content/public/browser/notification_details.h"
31 #include "content/public/browser/notification_service.h" 32 #include "content/public/browser/notification_service.h"
32 #include "content/public/browser/render_frame_host.h" 33 #include "content/public/browser/render_frame_host.h"
33 #include "content/public/browser/web_contents.h" 34 #include "content/public/browser/web_contents.h"
34 #include "content/public/test/browser_test_utils.h" 35 #include "content/public/test/browser_test_utils.h"
35 #include "device/geolocation/geoposition.h" 36 #include "device/geolocation/geoposition.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 308
308 current_url_ = embedded_test_server()->GetURL(html_for_tests_); 309 current_url_ = embedded_test_server()->GetURL(html_for_tests_);
309 if (options == INITIALIZATION_OFFTHERECORD) { 310 if (options == INITIALIZATION_OFFTHERECORD) {
310 current_browser_ = OpenURLOffTheRecord(browser()->profile(), current_url_); 311 current_browser_ = OpenURLOffTheRecord(browser()->profile(), current_url_);
311 } else { 312 } else {
312 current_browser_ = browser(); 313 current_browser_ = browser();
313 if (options == INITIALIZATION_NEWTAB) 314 if (options == INITIALIZATION_NEWTAB)
314 chrome::NewTab(current_browser_); 315 chrome::NewTab(current_browser_);
315 } 316 }
316 ASSERT_TRUE(current_browser_); 317 ASSERT_TRUE(current_browser_);
318 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(current_browser_));
317 if (options != INITIALIZATION_OFFTHERECORD) 319 if (options != INITIALIZATION_OFFTHERECORD)
318 ui_test_utils::NavigateToURL(current_browser_, current_url_); 320 ui_test_utils::NavigateToURL(current_browser_, current_url_);
319 321
320 // By default the main frame is used for JavaScript execution. 322 // By default the main frame is used for JavaScript execution.
321 SetFrameForScriptExecution(""); 323 SetFrameForScriptExecution("");
322 } 324 }
323 325
324 void GeolocationBrowserTest::LoadIFrames() { 326 void GeolocationBrowserTest::LoadIFrames() {
325 int number_iframes = 2; 327 int number_iframes = 2;
326 iframe_urls_.resize(number_iframes); 328 iframe_urls_.resize(number_iframes);
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 // Calling watchPosition should trigger the last usage update. 767 // Calling watchPosition should trigger the last usage update.
766 WatchPositionAndObservePermissionRequest(false); 768 WatchPositionAndObservePermissionRequest(false);
767 ExpectPosition(fake_latitude(), fake_longitude()); 769 ExpectPosition(fake_latitude(), fake_longitude());
768 770
769 // Last usage has been updated. 771 // Last usage has been updated.
770 EXPECT_EQ(GetHostContentSettingsMap()->GetLastUsage( 772 EXPECT_EQ(GetHostContentSettingsMap()->GetLastUsage(
771 current_url().GetOrigin(), 773 current_url().GetOrigin(),
772 current_url().GetOrigin(), 774 current_url().GetOrigin(),
773 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 13); 775 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 13);
774 } 776 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698