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

Side by Side Diff: components/offline_pages/core/request_header/offline_page_header_unittest.cc

Issue 2489443002: Move all components/offline_pages/ files into component/offline_pages/core (Closed)
Patch Set: rebase Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/offline_pages/request_header/offline_page_header.h" 5 #include "components/offline_pages/core/request_header/offline_page_header.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace offline_pages { 9 namespace offline_pages {
10 10
11 class OfflinePageHeaderTest : public testing::Test { 11 class OfflinePageHeaderTest : public testing::Test {
12 public: 12 public:
13 OfflinePageHeaderTest() {} 13 OfflinePageHeaderTest() {}
14 ~OfflinePageHeaderTest() override {} 14 ~OfflinePageHeaderTest() override {}
15 15
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 EXPECT_FALSE(need_to_persist); 57 EXPECT_FALSE(need_to_persist);
58 EXPECT_EQ(OfflinePageHeader::Reason::NET_ERROR, reason); 58 EXPECT_EQ(OfflinePageHeader::Reason::NET_ERROR, reason);
59 EXPECT_EQ("", id); 59 EXPECT_EQ("", id);
60 60
61 EXPECT_TRUE(ParseFromHeaderValue("id=a1b2", &need_to_persist, &reason, &id)); 61 EXPECT_TRUE(ParseFromHeaderValue("id=a1b2", &need_to_persist, &reason, &id));
62 EXPECT_FALSE(need_to_persist); 62 EXPECT_FALSE(need_to_persist);
63 EXPECT_EQ(OfflinePageHeader::Reason::NONE, reason); 63 EXPECT_EQ(OfflinePageHeader::Reason::NONE, reason);
64 EXPECT_EQ("a1b2", id); 64 EXPECT_EQ("a1b2", id);
65 65
66 EXPECT_TRUE(ParseFromHeaderValue("persist=1 reason=download id=a1b2", 66 EXPECT_TRUE(ParseFromHeaderValue("persist=1 reason=download id=a1b2",
67 &need_to_persist, &reason, &id)); 67 &need_to_persist, &reason, &id));
68 EXPECT_TRUE(need_to_persist); 68 EXPECT_TRUE(need_to_persist);
69 EXPECT_EQ(OfflinePageHeader::Reason::DOWNLOAD, reason); 69 EXPECT_EQ(OfflinePageHeader::Reason::DOWNLOAD, reason);
70 EXPECT_EQ("a1b2", id); 70 EXPECT_EQ("a1b2", id);
71 } 71 }
72 72
73 TEST_F(OfflinePageHeaderTest, ToString) { 73 TEST_F(OfflinePageHeaderTest, ToString) {
74 OfflinePageHeader header; 74 OfflinePageHeader header;
75 header.need_to_persist = true; 75 header.need_to_persist = true;
76 header.reason = OfflinePageHeader::Reason::DOWNLOAD; 76 header.reason = OfflinePageHeader::Reason::DOWNLOAD;
77 header.id = "a1b2"; 77 header.id = "a1b2";
78 EXPECT_EQ("X-Chrome-offline: persist=1 reason=download id=a1b2", 78 EXPECT_EQ("X-Chrome-offline: persist=1 reason=download id=a1b2",
79 header.GetCompleteHeaderString()); 79 header.GetCompleteHeaderString());
80 } 80 }
81 81
82 } // namespace offline_pages 82 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698