Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: url/origin_unittest.cc

Issue 2105123002: various: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/message_center/message_center_impl.cc ('k') | url/scheme_host_port_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "url/gurl.h" 11 #include "url/gurl.h"
12 #include "url/origin.h" 12 #include "url/origin.h"
13 13
14 namespace { 14 namespace {
15 15
16 TEST(OriginTest, UniqueOriginComparison) { 16 TEST(OriginTest, UniqueOriginComparison) {
17 url::Origin unique_origin; 17 url::Origin unique_origin;
18 EXPECT_EQ("", unique_origin.scheme()); 18 EXPECT_EQ("", unique_origin.scheme());
19 EXPECT_EQ("", unique_origin.host()); 19 EXPECT_EQ("", unique_origin.host());
20 EXPECT_EQ(0, unique_origin.port()); 20 EXPECT_EQ(0, unique_origin.port());
21 EXPECT_TRUE(unique_origin.unique()); 21 EXPECT_TRUE(unique_origin.unique());
22 EXPECT_FALSE(unique_origin.IsSameOriginWith(unique_origin)); 22 EXPECT_FALSE(unique_origin.IsSameOriginWith(unique_origin));
23 23
24 const char* const urls[] = {"data:text/html,Hello!", 24 const char* const urls[] = {"data:text/html,Hello!",
25 "javascript:alert(1)", 25 "javascript:alert(1)",
26 "file://example.com:443/etc/passwd", 26 "file://example.com:443/etc/passwd",
27 "yay", 27 "yay",
28 "http::///invalid.example.com/"}; 28 "http::///invalid.example.com/"};
29 29
30 for (const auto& test_url : urls) { 30 for (auto* test_url : urls) {
31 SCOPED_TRACE(test_url); 31 SCOPED_TRACE(test_url);
32 GURL url(test_url); 32 GURL url(test_url);
33 url::Origin origin(url); 33 url::Origin origin(url);
34 EXPECT_EQ("", origin.scheme()); 34 EXPECT_EQ("", origin.scheme());
35 EXPECT_EQ("", origin.host()); 35 EXPECT_EQ("", origin.host());
36 EXPECT_EQ(0, origin.port()); 36 EXPECT_EQ(0, origin.port());
37 EXPECT_TRUE(origin.unique()); 37 EXPECT_TRUE(origin.unique());
38 EXPECT_FALSE(origin.IsSameOriginWith(origin)); 38 EXPECT_FALSE(origin.IsSameOriginWith(origin));
39 EXPECT_FALSE(unique_origin.IsSameOriginWith(origin)); 39 EXPECT_FALSE(unique_origin.IsSameOriginWith(origin));
40 EXPECT_FALSE(origin.IsSameOriginWith(unique_origin)); 40 EXPECT_FALSE(origin.IsSameOriginWith(unique_origin));
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 std::string(test.host, test.host_length), test.port); 246 std::string(test.host, test.host_length), test.port);
247 EXPECT_EQ("", origin.scheme()); 247 EXPECT_EQ("", origin.scheme());
248 EXPECT_EQ("", origin.host()); 248 EXPECT_EQ("", origin.host());
249 EXPECT_EQ(0, origin.port()); 249 EXPECT_EQ(0, origin.port());
250 EXPECT_TRUE(origin.unique()); 250 EXPECT_TRUE(origin.unique());
251 EXPECT_FALSE(origin.IsSameOriginWith(origin)); 251 EXPECT_FALSE(origin.IsSameOriginWith(origin));
252 } 252 }
253 } 253 }
254 254
255 } // namespace url 255 } // namespace url
OLDNEW
« no previous file with comments | « ui/message_center/message_center_impl.cc ('k') | url/scheme_host_port_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698