diff options
Diffstat (limited to 'chrome/renderer/net/renderer_predictor_unittest.cc')
-rw-r--r-- | chrome/renderer/net/renderer_predictor_unittest.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/chrome/renderer/net/renderer_predictor_unittest.cc b/chrome/renderer/net/renderer_predictor_unittest.cc new file mode 100644 index 0000000..a987ba0 --- /dev/null +++ b/chrome/renderer/net/renderer_predictor_unittest.cc @@ -0,0 +1,36 @@ +// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Single threaded tests of RendererNetPredictor functionality. + +#include "chrome/renderer/net/renderer_net_predictor.h" +#include "testing/gtest/include/gtest/gtest.h" + +#include <algorithm> + +namespace { + +class RenderDnsMasterTest : public testing::Test { +}; + +TEST(RenderDnsMasterTest, NumericIpDiscardCheck) { + // Regular names. + const std::string A("a.com"), B("b.net"), C("www.other.uk"); + // Combination of digits plus dots. + const std::string N1("1.3."), N2("5.5.7.12"); + +#define TESTNAME(string) RendererNetPredictor::is_numeric_ip((string.data()), \ + (string).size()) + + EXPECT_TRUE(TESTNAME(N1)); + EXPECT_TRUE(TESTNAME(N2)); + + EXPECT_FALSE(TESTNAME(A)); + EXPECT_FALSE(TESTNAME(B)); + EXPECT_FALSE(TESTNAME(C)); + +#undef TESTNAME +} + +} // namespace anonymous |