| Index: content/child/site_isolation_stats_gatherer_unittest.cc
|
| diff --git a/net/test/channel_id_test_util.cc b/content/child/site_isolation_stats_gatherer_unittest.cc
|
| similarity index 26%
|
| copy from net/test/channel_id_test_util.cc
|
| copy to content/child/site_isolation_stats_gatherer_unittest.cc
|
| index 77007f2a879dee13009f7ba9b15911d1f5788494..23feb4a5bb70296ea4c6edf392ceef852787dcb4 100644
|
| --- a/net/test/channel_id_test_util.cc
|
| +++ b/content/child/site_isolation_stats_gatherer_unittest.cc
|
| @@ -2,24 +2,25 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "net/test/channel_id_test_util.h"
|
| +#include "base/strings/string_piece.h"
|
| +#include "content/child/site_isolation_stats_gatherer.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
|
|
| -#include <string>
|
| +using base::StringPiece;
|
|
|
| -#include "crypto/ec_private_key.h"
|
| -#include "testing/gtest/include/gtest/gtest.h"
|
| +namespace content {
|
| +
|
| +TEST(SiteIsolationStatsGathererTest, SniffForJS) {
|
| + StringPiece basic_js_data("var a = 4");
|
| + StringPiece js_data("\t\t\r\n var a = 4");
|
| + StringPiece json_data("\t\t\r\n { \"name\" : \"chrome\", ");
|
| + StringPiece empty_data("");
|
|
|
| -namespace net {
|
| + EXPECT_TRUE(SiteIsolationStatsGatherer::SniffForJS(js_data));
|
| + EXPECT_FALSE(SiteIsolationStatsGatherer::SniffForJS(json_data));
|
|
|
| -::testing::AssertionResult KeysEqual(crypto::ECPrivateKey* key1,
|
| - crypto::ECPrivateKey* key2) {
|
| - std::string public_key1, public_key2;
|
| - EXPECT_TRUE(key1 && key1->ExportRawPublicKey(&public_key1));
|
| - EXPECT_TRUE(key2 && key2->ExportRawPublicKey(&public_key2));
|
| - if (public_key1 == public_key2)
|
| - return ::testing::AssertionSuccess();
|
| - else
|
| - return ::testing::AssertionFailure();
|
| + // Basic bounds check.
|
| + EXPECT_FALSE(SiteIsolationStatsGatherer::SniffForJS(empty_data));
|
| }
|
|
|
| -} // namespace net
|
| +} // namespace content
|
|
|