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

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

Issue 658005: Bring Geolocation to life!... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/geolocation/geolocation_dispatcher_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/string_util.h" 5 #include "base/string_util.h"
6 #include "chrome/browser/app_modal_dialog.h" 6 #include "chrome/browser/app_modal_dialog.h"
7 #include "chrome/browser/browser.h" 7 #include "chrome/browser/browser.h"
8 #include "chrome/browser/browser_list.h" 8 #include "chrome/browser/browser_list.h"
9 #include "chrome/browser/geolocation/location_arbitrator.h"
9 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
10 #include "chrome/browser/renderer_host/render_view_host.h" 11 #include "chrome/browser/renderer_host/render_view_host.h"
11 #include "chrome/browser/tab_contents/tab_contents.h" 12 #include "chrome/browser/tab_contents/tab_contents.h"
12 #include "chrome/common/chrome_paths.h" 13 #include "chrome/common/chrome_paths.h"
13 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/geoposition.h" 15 #include "chrome/common/geoposition.h"
15 #include "chrome/common/notification_details.h" 16 #include "chrome/common/notification_details.h"
16 #include "chrome/common/notification_service.h" 17 #include "chrome/common/notification_service.h"
17 #include "chrome/common/notification_type.h" 18 #include "chrome/common/notification_type.h"
18 #include "chrome/common/render_messages.h" 19 #include "chrome/common/render_messages.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 EnableDOMAutomation(); 63 EnableDOMAutomation();
63 } 64 }
64 65
65 enum InitializationOptions { 66 enum InitializationOptions {
66 INITIALIZATION_NONE, 67 INITIALIZATION_NONE,
67 INITIALIZATION_OFFTHERECORD, 68 INITIALIZATION_OFFTHERECORD,
68 INITIALIZATION_NEWTAB, 69 INITIALIZATION_NEWTAB,
69 }; 70 };
70 71
71 void Initialize(InitializationOptions options) { 72 void Initialize(InitializationOptions options) {
73 GeolocationArbitrator::SetUseMockProvider(true);
72 if (!server_.get()) { 74 if (!server_.get()) {
73 server_ = StartHTTPServer(); 75 server_ = StartHTTPServer();
74 } 76 }
75 GURL url = server_->TestServerPage("files/geolocation/simple.html"); 77 GURL url = server_->TestServerPage("files/geolocation/simple.html");
76 LOG(WARNING) << "before navigate"; 78 LOG(WARNING) << "before navigate";
77 if (options == INITIALIZATION_OFFTHERECORD) { 79 if (options == INITIALIZATION_OFFTHERECORD) {
78 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), url); 80 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), url);
79 current_browser_ = BrowserList::FindBrowserWithType( 81 current_browser_ = BrowserList::FindBrowserWithType(
80 browser()->profile()->GetOffTheRecordProfile(), Browser::TYPE_NORMAL); 82 browser()->profile()->GetOffTheRecordProfile(), Browser::TYPE_NORMAL);
81 } else if (options == INITIALIZATION_NEWTAB) { 83 } else if (options == INITIALIZATION_NEWTAB) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 &value)); 167 &value));
166 LOG(WARNING) << "JS value checked"; 168 LOG(WARNING) << "JS value checked";
167 EXPECT_EQ(expected, value); 169 EXPECT_EQ(expected, value);
168 } 170 }
169 171
170 // InProcessBrowserTest 172 // InProcessBrowserTest
171 virtual void SetUpCommandLine(CommandLine* command_line) { 173 virtual void SetUpCommandLine(CommandLine* command_line) {
172 InProcessBrowserTest::SetUpCommandLine(command_line); 174 InProcessBrowserTest::SetUpCommandLine(command_line);
173 command_line->AppendSwitch(switches::kEnableGeolocation); 175 command_line->AppendSwitch(switches::kEnableGeolocation);
174 } 176 }
177 virtual void TearDownInProcessBrowserTestFixture() {
178 GeolocationArbitrator::SetUseMockProvider(false);
179 }
175 180
176 scoped_refptr<HTTPTestServer> server_; 181 scoped_refptr<HTTPTestServer> server_;
177 InfoBarDelegate* infobar_; 182 InfoBarDelegate* infobar_;
178 Browser* current_browser_; 183 Browser* current_browser_;
179 }; 184 };
180 185
181 #if defined(OS_MACOSX) 186 #if defined(OS_MACOSX)
182 // TODO(bulach): investigate why this fails on mac. It may be related to: 187 // TODO(bulach): investigate why this fails on mac. It may be related to:
183 // http://crbug.com//29424 188 // http://crbug.com//29424
184 #define MAYBE_DisplaysPermissionBar DISABLED_DisplaysPermissionBar 189 #define MAYBE_DisplaysPermissionBar DISABLED_DisplaysPermissionBar
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 geoposition.latitude = 3.17; 321 geoposition.latitude = 3.17;
317 geoposition.longitude = 4.23; 322 geoposition.longitude = 4.23;
318 SendGeoposition(false, geoposition); 323 SendGeoposition(false, geoposition);
319 // Checks we have no error. 324 // Checks we have no error.
320 CheckValueFromJavascript("0", "geoGetLastError()"); 325 CheckValueFromJavascript("0", "geoGetLastError()");
321 CheckValueFromJavascript( 326 CheckValueFromJavascript(
322 DoubleToString(geoposition.latitude), "geoGetLastPositionLatitude()"); 327 DoubleToString(geoposition.latitude), "geoGetLastPositionLatitude()");
323 CheckValueFromJavascript( 328 CheckValueFromJavascript(
324 DoubleToString(geoposition.longitude), "geoGetLastPositionLongitude()"); 329 DoubleToString(geoposition.longitude), "geoGetLastPositionLongitude()");
325 } 330 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/geolocation/geolocation_dispatcher_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698