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

Side by Side Diff: Source/modules/geolocation/testing/InternalsGeolocation.cpp

Issue 322583002: Fix InternalsGeolocation::setGeolocationClientMock to actually set the test client for all Geolocat… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix test Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 29 matching lines...) Expand all
40 #include "modules/geolocation/testing/GeolocationClientMock.h" 40 #include "modules/geolocation/testing/GeolocationClientMock.h"
41 #include "wtf/CurrentTime.h" 41 #include "wtf/CurrentTime.h"
42 42
43 namespace WebCore { 43 namespace WebCore {
44 44
45 void InternalsGeolocation::setGeolocationClientMock(Internals&, Document* docume nt) 45 void InternalsGeolocation::setGeolocationClientMock(Internals&, Document* docume nt)
46 { 46 {
47 ASSERT(document && document->frame()); 47 ASSERT(document && document->frame());
48 GeolocationClientMock* client = new GeolocationClientMock(); 48 GeolocationClientMock* client = new GeolocationClientMock();
49 49
50 for (LocalFrame* childFrame = document->page()->mainFrame(); childFrame; chi ldFrame = childFrame->tree().nextSibling()) 50 for (LocalFrame* childFrame = document->page()->mainFrame(); childFrame; chi ldFrame = childFrame->tree().traverseNext())
51 GeolocationController::from(document->frame())->setClientForTest(client) ; 51 GeolocationController::from(childFrame)->setClientForTest(client);
52 } 52 }
53 53
54 void InternalsGeolocation::setGeolocationPosition(Internals&, Document* document , double latitude, double longitude, double accuracy) 54 void InternalsGeolocation::setGeolocationPosition(Internals&, Document* document , double latitude, double longitude, double accuracy)
55 { 55 {
56 ASSERT(document && document->frame()); 56 ASSERT(document && document->frame());
57 GeolocationClientMock* client = geolocationClient(document); 57 GeolocationClientMock* client = geolocationClient(document);
58 if (!client) 58 if (!client)
59 return; 59 return;
60 client->setPosition(GeolocationPosition::create(currentTime(), latitude, lon gitude, accuracy)); 60 client->setPosition(GeolocationPosition::create(currentTime(), latitude, lon gitude, accuracy));
61 } 61 }
(...skipping 27 matching lines...) Expand all
89 89
90 GeolocationClientMock* InternalsGeolocation::geolocationClient(Document* documen t) 90 GeolocationClientMock* InternalsGeolocation::geolocationClient(Document* documen t)
91 { 91 {
92 GeolocationController* controller = GeolocationController::from(document->fr ame()); 92 GeolocationController* controller = GeolocationController::from(document->fr ame());
93 if (!controller->hasClientForTest()) 93 if (!controller->hasClientForTest())
94 return 0; 94 return 0;
95 return static_cast<GeolocationClientMock*>(controller->client()); 95 return static_cast<GeolocationClientMock*>(controller->client());
96 } 96 }
97 97
98 } // namespace WebCore 98 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698