Index: components/gcm_driver/instance_id/instance_id_driver_unittest.cc |
diff --git a/components/gcm_driver/instance_id/instance_id_driver_unittest.cc b/components/gcm_driver/instance_id/instance_id_driver_unittest.cc |
index 8997296aca9b1dad49e6749524421ca3094672b6..63fba0f57a89fcbddab981cc46e8f805d95522f9 100644 |
--- a/components/gcm_driver/instance_id/instance_id_driver_unittest.cc |
+++ b/components/gcm_driver/instance_id/instance_id_driver_unittest.cc |
@@ -17,6 +17,11 @@ |
#include "components/gcm_driver/instance_id/instance_id.h" |
#include "testing/gtest/include/gtest/gtest.h" |
+#if defined(OS_ANDROID) |
+#include "components/gcm_driver/instance_id/instance_id_android.h" |
+#include "components/gcm_driver/instance_id/instance_id_test_utils_android.h" |
+#endif // OS_ANDROID |
+ |
namespace instance_id { |
namespace { |
@@ -52,6 +57,7 @@ class InstanceIDDriverTest : public testing::Test { |
// testing::Test: |
void SetUp() override; |
+ void TearDown() override; |
void WaitForAsyncOperation(); |
@@ -105,10 +111,21 @@ InstanceIDDriverTest::~InstanceIDDriverTest() { |
} |
void InstanceIDDriverTest::SetUp() { |
+#if defined(OS_ANDROID) |
+ InstanceIDAndroid::SetBlockOnAsyncTasksForTesting(true); |
+ InstanceIDTestUtilsAndroid::ClearDataAndSetUseFakeForTesting(true); |
Peter Beverloo
2016/04/18 15:46:36
Would we ever used them separately? Could trigger
johnme
2016/04/19 11:15:43
I made them scoped objects. I left them separate f
|
+#endif // OS_ANDROID |
gcm_driver_.reset(new FakeGCMDriverForInstanceID); |
RecreateInstanceIDDriver(); |
} |
+void InstanceIDDriverTest::TearDown() { |
+#if defined(OS_ANDROID) |
+ InstanceIDTestUtilsAndroid::ClearDataAndSetUseFakeForTesting(false); |
+ InstanceIDAndroid::SetBlockOnAsyncTasksForTesting(false); |
+#endif // OS_ANDROID |
+} |
+ |
void InstanceIDDriverTest::RecreateInstanceIDDriver() { |
driver_.reset(new InstanceIDDriver(gcm_driver_.get())); |
} |