summaryrefslogtreecommitdiffstats
path: root/url/origin_unittest.cc
blob: c094ee6cf50efe6470da1da9586a11a4644fc341 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2014 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.

#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"

namespace url {

namespace {

// Each test examines the Origin is constructed correctly without
// violating DCHECKs.
TEST(OriginTest, constructEmpty) {
  Origin origin;
  EXPECT_EQ("null", origin.string());
}

TEST(OriginTest, constructNull) {
  Origin origin("null");
  EXPECT_EQ("null", origin.string());
}

TEST(OriginTest, constructValidOrigin) {
  Origin origin("http://example.com:8080");
  EXPECT_EQ("http://example.com:8080", origin.string());
}

TEST(OriginTest, constructValidFileOrigin) {
  Origin origin("file://");
  EXPECT_EQ("file://", origin.string());
}

TEST(OriginTest, constructValidOriginWithoutPort) {
  Origin origin("wss://example2.com");
  EXPECT_EQ("wss://example2.com", origin.string());
}

}  // namespace

}  // namespace url