Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / sync_file_system / subtree_set_unittest.cc
blob5a03b42be4e079a2ad378b9afcbf09d2a0237d52
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
3 // found in the LICENSE file.
5 #include "chrome/browser/sync_file_system/subtree_set.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 #define FPL(path) base::FilePath(FILE_PATH_LITERAL(path))
11 namespace sync_file_system {
13 TEST(SubtreeSetTest, InsertAndErase) {
14 SubtreeSet subtrees;
16 EXPECT_EQ(0u, subtrees.size());
17 EXPECT_TRUE(subtrees.insert(FPL("/a/b/c")));
18 EXPECT_FALSE(subtrees.insert(FPL("/a/b")));
19 EXPECT_FALSE(subtrees.insert(FPL("/a/b/c")));
20 EXPECT_FALSE(subtrees.insert(FPL("/a/b/c/d")));
21 EXPECT_TRUE(subtrees.insert(FPL("/a/b/d")));
22 EXPECT_FALSE(subtrees.insert(FPL("/")));
24 EXPECT_EQ(2u, subtrees.size());
26 EXPECT_FALSE(subtrees.erase(FPL("/")));
27 EXPECT_FALSE(subtrees.erase(FPL("/a")));
28 EXPECT_TRUE(subtrees.erase(FPL("/a/b/c")));
30 EXPECT_EQ(1u, subtrees.size());
32 EXPECT_TRUE(subtrees.insert(FPL("/a/b/c/d")));
34 EXPECT_EQ(2u, subtrees.size());
37 } // namespace sync_file_system