OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |