/src/mozilla-central/caps/tests/gtest/TestOriginAttributes.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
2 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | | #include "gtest/gtest.h" |
5 | | #include "mozilla/BasePrincipal.h" |
6 | | |
7 | | using mozilla::OriginAttributes; |
8 | | |
9 | | static void |
10 | | TestSuffix(const OriginAttributes& attrs) |
11 | 0 | { |
12 | 0 | nsAutoCString suffix; |
13 | 0 | attrs.CreateSuffix(suffix); |
14 | 0 |
|
15 | 0 | OriginAttributes attrsFromSuffix; |
16 | 0 | bool success = attrsFromSuffix.PopulateFromSuffix(suffix); |
17 | 0 | EXPECT_TRUE(success); |
18 | 0 |
|
19 | 0 | EXPECT_EQ(attrs, attrsFromSuffix); |
20 | 0 | } |
21 | | |
22 | | TEST(OriginAttributes, Suffix_default) |
23 | 0 | { |
24 | 0 | OriginAttributes attrs; |
25 | 0 | TestSuffix(attrs); |
26 | 0 | } |
27 | | |
28 | | TEST(OriginAttributes, Suffix_appId_inIsolatedMozBrowser) |
29 | 0 | { |
30 | 0 | OriginAttributes attrs(1, true); |
31 | 0 | TestSuffix(attrs); |
32 | 0 | } |
33 | | |
34 | | TEST(OriginAttributes, Suffix_maxAppId_inIsolatedMozBrowser) |
35 | 0 | { |
36 | 0 | OriginAttributes attrs(4294967295, true); |
37 | 0 | TestSuffix(attrs); |
38 | 0 | } |