• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "uri_helper_unit_test.h"
17 
18 #include <thread>
19 
20 using namespace OHOS;
21 using namespace OHOS::Media;
22 using namespace std;
23 using namespace testing::ext;
24 
25 namespace OHOS {
26 namespace Media {
27 namespace Test {
SetUpTestCase(void)28 void UriHelperUnitTest::SetUpTestCase(void) {}
29 
TearDownTestCase(void)30 void UriHelperUnitTest::TearDownTestCase(void) {}
31 
SetUp(void)32 void UriHelperUnitTest::SetUp(void) {}
33 
TearDown(void)34 void UriHelperUnitTest::TearDown(void) {}
35 
36 
37 HWTEST_F(UriHelperUnitTest, UriHelper_001, TestSize.Level0)
38 {
39     std::string_view input = "   ";
40     UriHelper uriHelper(input);
41     ASSERT_EQ(uriHelper.formattedUri_, "");
42 }
43 
44 HWTEST_F(UriHelperUnitTest, UriHelper_002, TestSize.Level0)
45 {
46     std::string_view input = "http://www.example.com";
47     UriHelper uriHelper(input);
48     ASSERT_EQ(uriHelper.formattedUri_, "httpwww.example.com");
49 }
50 
51 HWTEST_F(UriHelperUnitTest, UriHelper_003, TestSize.Level0)
52 {
53     std::string_view input = "httpwww.example.com";
54     UriHelper uriHelper(input);
55     ASSERT_EQ(uriHelper.formattedUri_, "httpwww.example.com");
56 }
57 
58 HWTEST_F(UriHelperUnitTest, UriHelper_004, TestSize.Level0)
59 {
60     std::string_view input = "http://";
61     UriHelper uriHelper(input);
62     ASSERT_EQ(uriHelper.formattedUri_, "http");
63 }
64 
65 }  // namespace Test
66 }  // namespace Media
67 }  // namespace OHOS
68