Hide Google logo and custom launcher page in app list for non-Google search engines.
[chromium-blink-merge.git] / printing / page_range_unittest.cc
blob5370e97185582d042bb6514bf5dc5590954c3a7b
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "printing/page_range.h"
6 #include "testing/gtest/include/gtest/gtest.h"
8 TEST(PageRangeTest, RangeMerge) {
9 printing::PageRanges ranges;
10 printing::PageRange range;
11 range.from = 1;
12 range.to = 3;
13 ranges.push_back(range);
14 range.from = 10;
15 range.to = 12;
16 ranges.push_back(range);
17 range.from = 2;
18 range.to = 5;
19 ranges.push_back(range);
20 std::vector<int> pages(printing::PageRange::GetPages(ranges));
21 ASSERT_EQ(8U, pages.size());
22 EXPECT_EQ(1, pages[0]);
23 EXPECT_EQ(2, pages[1]);
24 EXPECT_EQ(3, pages[2]);
25 EXPECT_EQ(4, pages[3]);
26 EXPECT_EQ(5, pages[4]);
27 EXPECT_EQ(10, pages[5]);
28 EXPECT_EQ(11, pages[6]);
29 EXPECT_EQ(12, pages[7]);
32 TEST(PageRangeTest, Empty) {
33 printing::PageRanges ranges;
34 std::vector<int> pages(printing::PageRange::GetPages(ranges));
35 EXPECT_TRUE(pages.empty());
38 TEST(PageRangeTest, Huge) {
39 printing::PageRanges ranges;
40 printing::PageRange range;
41 range.from = 1;
42 range.to = 2000000000;
43 ranges.push_back(range);
44 std::vector<int> pages(printing::PageRange::GetPages(ranges));
45 EXPECT_FALSE(pages.empty());