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

Unified Diff: components/data_use_measurement/core/data_use_measurement_unittest.cc

Issue 2565173005: Make DataUseMeasurementTest.UserNotUserTest pass with lld/win. (Closed)
Patch Set: fix comment typo Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/data_use_measurement/core/data_use_measurement_unittest.cc
diff --git a/components/data_use_measurement/core/data_use_measurement_unittest.cc b/components/data_use_measurement/core/data_use_measurement_unittest.cc
index 707577b65152c325c2be79799df4f81bcd91c650..31a27847e77fa57a4b5c2fd923e8300d042cb42c 100644
--- a/components/data_use_measurement/core/data_use_measurement_unittest.cc
+++ b/components/data_use_measurement/core/data_use_measurement_unittest.cc
@@ -41,9 +41,21 @@ class UserRequestUserDataForTesting : public base::SupportsUserData::Data,
}
};
+// The more usual initialization of kUserDataKey would be along the lines of
+// const void* const UserRequestUserDataForTesting::kUserDataKey =
+// &UserRequestUserDataForTesting::kUserDataKey;
+// but lld's identical constant folding then folds that with
+// DataUseUserData::kUserDataKey which is initialized like that as well, and
+// then UserRequestUserDataForTesting::IsUserRequest() starts classifying
+// service requests as user requests. To work around this, make
+// UserRequestUserDataForTesting::kUserDataKey point to an arbitrary integer
+// instead.
+// TODO(thakis): If we changed lld to only ICF over code and not over data,
+// we could undo this again.
+const int kICFBuster = 12345634;
+
// static
-const void* const UserRequestUserDataForTesting::kUserDataKey =
- &UserRequestUserDataForTesting::kUserDataKey;
+const void* const UserRequestUserDataForTesting::kUserDataKey = &kICFBuster;
class DataUseMeasurementTest : public testing::Test {
public:
« 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