Commit e7cd037c authored by grt@chromium.org's avatar grt@chromium.org

Fix RLZ test support dependency.

BUG=393815
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/393903002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283753 0039d316-1c4b-4281-b951-d872f2087c98
parent 20e23d07
...@@ -17,9 +17,12 @@ ...@@ -17,9 +17,12 @@
#include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_browser_thread_bundle.h"
#include "content/public/test/test_utils.h" #include "content/public/test/test_utils.h"
#include "crypto/hmac.h" #include "crypto/hmac.h"
#include "rlz/lib/machine_id.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#if defined(ENABLE_RLZ)
#include "rlz/lib/machine_id.h"
#endif
namespace { namespace {
// extensions::api::DeviceId::GetDeviceId() signs the extension_id in // extensions::api::DeviceId::GetDeviceId() signs the extension_id in
...@@ -70,6 +73,7 @@ std::string GetDeviceIdFromRawDeviceId(const std::string& raw_device_id) { ...@@ -70,6 +73,7 @@ std::string GetDeviceIdFromRawDeviceId(const std::string& raw_device_id) {
return StringToLowerASCII(base::HexEncode(digest.data(), digest.size())); return StringToLowerASCII(base::HexEncode(digest.data(), digest.size()));
} }
#if defined(ENABLE_RLZ)
std::string GetLegacyIdBasedOnRlzId() { std::string GetLegacyIdBasedOnRlzId() {
std::string rlz_machine_id; std::string rlz_machine_id;
rlz_lib::GetMachineId(&rlz_machine_id); rlz_lib::GetMachineId(&rlz_machine_id);
...@@ -88,6 +92,7 @@ std::string GetLegacyIdBasedOnRlzId() { ...@@ -88,6 +92,7 @@ std::string GetLegacyIdBasedOnRlzId() {
return legacy_device_id; return legacy_device_id;
} }
#endif // ENABLE_RLZ
// Simulate browser threads (required by extensions::api::DeviceId) off of the // Simulate browser threads (required by extensions::api::DeviceId) off of the
// main message loop. // main message loop.
...@@ -104,14 +109,18 @@ class PrefHashCalculatorHelperTest : public testing::Test { ...@@ -104,14 +109,18 @@ class PrefHashCalculatorHelperTest : public testing::Test {
// results in the mean time (it will be okay for the extension API's // results in the mean time (it will be okay for the extension API's
// implementation to diverge on M34+ and this test can be removed once M34 ships // implementation to diverge on M34+ and this test can be removed once M34 ships
// to stable). // to stable).
#if defined(ENABLE_RLZ)
TEST_F(PrefHashCalculatorHelperTest, ResultMatchesMediaId) { TEST_F(PrefHashCalculatorHelperTest, ResultMatchesMediaId) {
EXPECT_EQ(GetMediaDeviceIdSynchronously(), GetLegacyIdBasedOnRlzId()); EXPECT_EQ(GetMediaDeviceIdSynchronously(), GetLegacyIdBasedOnRlzId());
} }
#endif // ENABLE_RLZ
TEST_F(PrefHashCalculatorHelperTest, MediaIdIsDeterministic) { TEST_F(PrefHashCalculatorHelperTest, MediaIdIsDeterministic) {
EXPECT_EQ(GetMediaDeviceIdSynchronously(), GetMediaDeviceIdSynchronously()); EXPECT_EQ(GetMediaDeviceIdSynchronously(), GetMediaDeviceIdSynchronously());
} }
#if defined(ENABLE_RLZ)
TEST_F(PrefHashCalculatorHelperTest, RlzBasedIdIsDeterministic) { TEST_F(PrefHashCalculatorHelperTest, RlzBasedIdIsDeterministic) {
EXPECT_EQ(GetLegacyIdBasedOnRlzId(), GetLegacyIdBasedOnRlzId()); EXPECT_EQ(GetLegacyIdBasedOnRlzId(), GetLegacyIdBasedOnRlzId());
} }
#endif // ENABLE_RLZ
...@@ -492,7 +492,6 @@ ...@@ -492,7 +492,6 @@
'../content/content.gyp:content_app_both', '../content/content.gyp:content_app_both',
'../net/net.gyp:net', '../net/net.gyp:net',
'../net/net.gyp:net_test_support', '../net/net.gyp:net_test_support',
'../rlz/rlz.gyp:test_support_rlz',
'../sync/sync.gyp:test_support_sync_api', '../sync/sync.gyp:test_support_sync_api',
'../sync/sync.gyp:test_support_sync_core', '../sync/sync.gyp:test_support_sync_core',
'../sync/sync.gyp:test_support_sync_internal_api', '../sync/sync.gyp:test_support_sync_internal_api',
...@@ -2484,7 +2483,11 @@ ...@@ -2484,7 +2483,11 @@
'utility/media_galleries/iphoto_library_parser_unittest.cc', 'utility/media_galleries/iphoto_library_parser_unittest.cc',
], ],
}], }],
['enable_rlz==0', { ['enable_rlz!=0', {
'dependencies': [
'../rlz/rlz.gyp:test_support_rlz',
],
}, { # enable_rlz==0
'sources!': [ 'sources!': [
'browser/rlz/rlz_unittest.cc', 'browser/rlz/rlz_unittest.cc',
], ],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment