Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / content / child / site_isolation_stats_gatherer_unittest.cc
blob23feb4a5bb70296ea4c6edf392ceef852787dcb4
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/strings/string_piece.h"
6 #include "content/child/site_isolation_stats_gatherer.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 using base::StringPiece;
11 namespace content {
13 TEST(SiteIsolationStatsGathererTest, SniffForJS) {
14 StringPiece basic_js_data("var a = 4");
15 StringPiece js_data("\t\t\r\n var a = 4");
16 StringPiece json_data("\t\t\r\n { \"name\" : \"chrome\", ");
17 StringPiece empty_data("");
19 EXPECT_TRUE(SiteIsolationStatsGatherer::SniffForJS(js_data));
20 EXPECT_FALSE(SiteIsolationStatsGatherer::SniffForJS(json_data));
22 // Basic bounds check.
23 EXPECT_FALSE(SiteIsolationStatsGatherer::SniffForJS(empty_data));
26 } // namespace content