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

Side by Side Diff: Source/core/fetch/ResourceLoaderOptionsTest.cpp

Issue 807263002: replace COMPILE_ASSERT with static_assert in core/fetch/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef ResourceLoaderOptionsTest_h 5 #ifndef ResourceLoaderOptionsTest_h
6 #define ResourceLoaderOptionsTest_h 6 #define ResourceLoaderOptionsTest_h
7 7
8 #include "config.h" 8 #include "config.h"
9 #include "core/fetch/ResourceLoaderOptions.h" 9 #include "core/fetch/ResourceLoaderOptions.h"
10 10
11 #include "wtf/TypeTraits.h" 11 #include "wtf/TypeTraits.h"
12 12
13 #include <gtest/gtest.h> 13 #include <gtest/gtest.h>
14 14
15 namespace blink { 15 namespace blink {
16 16
17 namespace { 17 namespace {
18 18
19 TEST(ResourceLoaderOptionsTest, DeepCopy) 19 TEST(ResourceLoaderOptionsTest, DeepCopy)
20 { 20 {
21 // Check that the fields of ResourceLoaderOptions are enums, 21 // Check that the fields of ResourceLoaderOptions are enums,
22 // except for initiatorInfo and securityOrigin. 22 // except for initiatorInfo and securityOrigin.
23 COMPILE_ASSERT(WTF::IsConvertibleToInteger<DataBufferingPolicy>::value, Data BufferingPolicy_is_enum); 23 static_assert(WTF::IsEnum<DataBufferingPolicy>::value, "DataBufferingPolicy should be an enum");
24 COMPILE_ASSERT(WTF::IsConvertibleToInteger<StoredCredentials>::value, Stored Credentials_is_enum); 24 static_assert(WTF::IsEnum<StoredCredentials>::value, "StoredCredentials shou ld be an enum");
25 COMPILE_ASSERT(WTF::IsConvertibleToInteger<CredentialRequest>::value, Creden tialRequest_is_enum); 25 static_assert(WTF::IsEnum<CredentialRequest>::value, "CredentialRequest shou ld be an enum");
26 COMPILE_ASSERT(WTF::IsConvertibleToInteger<ContentSecurityPolicyDisposition> ::value, ContentSecurityPolicyDisposition_is_enum); 26 static_assert(WTF::IsEnum<ContentSecurityPolicyDisposition>::value, "Content SecurityPolicyDisposition should be an enum");
27 COMPILE_ASSERT(WTF::IsConvertibleToInteger<RequestInitiatorContext>::value, RequestInitiatorContext_is_enum); 27 static_assert(WTF::IsEnum<RequestInitiatorContext>::value, "RequestInitiator Context should be an enum");
28 COMPILE_ASSERT(WTF::IsConvertibleToInteger<MixedContentBlockingTreatment>::v alue, MixedContentBlockingTreatment_is_enum); 28 static_assert(WTF::IsEnum<MixedContentBlockingTreatment>::value, "MixedConte ntBlockingTreatment should be an enum");
29 COMPILE_ASSERT(WTF::IsConvertibleToInteger<SynchronousPolicy>::value, Synchr onousPolicy_is_enum); 29 static_assert(WTF::IsEnum<SynchronousPolicy>::value, "SynchronousPolicy shou ld be an enum");
30 COMPILE_ASSERT(WTF::IsConvertibleToInteger<CORSEnabled>::value, CORSEnabled_ is_enum); 30 static_assert(WTF::IsEnum<CORSEnabled>::value, "CORSEnabled should be an enu m");
31 31
32 ResourceLoaderOptions original; 32 ResourceLoaderOptions original;
33 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString("ht tp://www.google.com"); 33 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString("ht tp://www.google.com");
34 original.securityOrigin = securityOrigin; 34 original.securityOrigin = securityOrigin;
35 original.initiatorInfo.name = AtomicString("xmlhttprequest"); 35 original.initiatorInfo.name = AtomicString("xmlhttprequest");
36 36
37 CrossThreadResourceLoaderOptionsData copyData = CrossThreadCopier<ResourceLo aderOptions>::copy(original); 37 CrossThreadResourceLoaderOptionsData copyData = CrossThreadCopier<ResourceLo aderOptions>::copy(original);
38 ResourceLoaderOptions copy = copyData; 38 ResourceLoaderOptions copy = copyData;
39 39
40 // Check that contents are correctly copied to |copyData| 40 // Check that contents are correctly copied to |copyData|
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // securityOrigin here is not complete (i.e. m_filePath is not checked). 90 // securityOrigin here is not complete (i.e. m_filePath is not checked).
91 // A unit test for SecurityOrigin::isolatedCopy() that covers these checks 91 // A unit test for SecurityOrigin::isolatedCopy() that covers these checks
92 // should be added. 92 // should be added.
93 } 93 }
94 94
95 } // namespace 95 } // namespace
96 96
97 } // namespace blink 97 } // namespace blink
98 98
99 #endif // ResourceLoaderOptionsTest_h 99 #endif // ResourceLoaderOptionsTest_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698