Take AnonymizerTool calls off the UI thread
Executing the AnonymizerTool is an expensive operation and should not happen on
the UI thread. This CL moves all existing calls on the UI thread to spearate
worker TaskRunners.
Bug: 787554
Change-Id: I3c096873f784cc2a9dd23f9dd538e2aebd075cd0
Reviewed-on: https://chromium-review.googlesource.com/787713
Commit-Queue: Dominic Battré <[email protected]>
Reviewed-by: Simon Que <[email protected]>
Reviewed-by: Bartosz Fabianowski <[email protected]>
Reviewed-by: Devlin <[email protected]>
Reviewed-by: Robert Liao <[email protected]>
Reviewed-by: Ahmed Fakhry <[email protected]>
Cr-Commit-Position: refs/heads/master@{#522435}
diff --git a/components/feedback/anonymizer_tool_unittest.cc b/components/feedback/anonymizer_tool_unittest.cc
index c0b8754..524a5ab4 100644
--- a/components/feedback/anonymizer_tool_unittest.cc
+++ b/components/feedback/anonymizer_tool_unittest.cc
@@ -201,4 +201,30 @@
&space));
}
+TEST_F(AnonymizerToolTest, AnonymizeChunk) {
+ std::string data =
+ "aaaaaaaa [SSID=123aaaaaa]aaaaa\n" // SSID.
+ "aaaaaaaahttp://tets.comaaaaaaa\n" // URL.
+ "[email protected]\n" // Email address.
+ "example@@1234\n" // No PII, it is not valid email address.
+ "255.255.155.255\n" // IP address.
+ "aaaa123.123.45.4aaa\n" // IP address.
+ "11:11;11::11\n" // IP address.
+ "11::11\n" // IP address.
+ "11:11:abcdef:0:0:0:0:0\n" // No PII.
+ "aa:aa:aa:aa:aa:aa"; // MAC address (BSSID).
+ std::string result =
+ "aaaaaaaa [SSID=1]aaaaa\n"
+ "aaaaaaaa<URL: 1>\n"
+ "<email: 1>\n"
+ "example@@1234\n"
+ "<IPv4: 1>55\n"
+ "aaaa<IPv4: 2>aaa\n"
+ "11:11;<IPv6: 1>\n"
+ "<IPv6: 1>\n"
+ "11:11:abcdef:0:0:0:0:0\n"
+ "aa:aa:aa:00:00:01";
+ EXPECT_EQ(result, anonymizer_.Anonymize(data));
+}
+
} // namespace feedback