Merge lp:~mardy/location-service/lp1499256 into lp:location-service/trunk
| Status: | Merged |
|---|---|
| Approved by: | Thomas Voß on 2015-10-15 |
| Approved revision: | 218 |
| Merge reported by: | Thomas Voß |
| Merged at revision: | not available |
| Proposed branch: | lp:~mardy/location-service/lp1499256 |
| Merge into: | lp:location-service/trunk |
| Diff against target: |
129 lines (+86/-3) 2 files modified
src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.cpp (+3/-3) tests/gps_provider_test.cpp (+83/-0) |
| To merge this branch: | bzr merge lp:~mardy/location-service/lp1499256 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Thomas Voß (community) | 2015-10-14 | Approve on 2015-10-15 | |
| PS Jenkins bot | continuous-integration | Approve on 2015-10-15 | |
|
Review via email:
|
|||
Commit Message
Make sure that injected time is given in milliseconds
Description of the Change
Make sure that injected time is given in milliseconds
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:216
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 217. By Alberto Mardegan on 2015-10-15
-
Add comment
| Alberto Mardegan (mardy) wrote : | # |
On 10/14/2015 02:45 PM, Thomas Voß wrote:
> A singleton is fine here, I would however prefer: static MockHardwareGps *instance() { static MockHardwareGps inst; return &inst; }
> With that, you can get rid of custom ctor and dtor, as well as the static instance_.
I tried that, but it doesn't work because the object is instantiated in
the test as
NiceMock<
and not via the MockHardwareGps
objects are created.
A possibility would be to make the instance() method return a NiceMock'd
instance. Would you prefer that?
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:217
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
| Thomas Voß (thomas-voss) wrote : | # |
> On 10/14/2015 02:45 PM, Thomas Voß wrote:
> > A singleton is fine here, I would however prefer: static MockHardwareGps
> *instance() { static MockHardwareGps inst; return &inst; }
> > With that, you can get rid of custom ctor and dtor, as well as the static
> instance_.
>
> I tried that, but it doesn't work because the object is instantiated in
> the test as
>
> NiceMock<
>
> and not via the MockHardwareGps
> objects are created.
> A possibility would be to make the instance() method return a NiceMock'd
> instance. Would you prefer that?
Nah, stick with the instance member. Returning a NiceMock would require individual tests to manually verify and clear expectations as one global object would be reused for all tests. I think the benefit of your code is a fresh instance per test.
Some documentation would be great, though :)
- 218. By Alberto Mardegan on 2015-10-15
-
Explain mock rationale
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:218
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://


Thanks for the changes. Two minor niggles inline.