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

Side by Side Diff: tools/gn/visibility_unittest.cc

Issue 552843005: Convert GN visibility to be a list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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
« no previous file with comments | « tools/gn/visibility.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "tools/gn/err.h" 6 #include "tools/gn/err.h"
7 #include "tools/gn/label.h" 7 #include "tools/gn/label.h"
8 #include "tools/gn/value.h" 8 #include "tools/gn/value.h"
9 #include "tools/gn/visibility.h" 9 #include "tools/gn/visibility.h"
10 10
(...skipping 15 matching lines...) Expand all
26 EXPECT_TRUE(vis.CanSeeMe(Label(SourceDir("//rec/a/"), "anything"))); 26 EXPECT_TRUE(vis.CanSeeMe(Label(SourceDir("//rec/a/"), "anything")));
27 EXPECT_TRUE(vis.CanSeeMe(Label(SourceDir("//rec/b/"), "anything"))); 27 EXPECT_TRUE(vis.CanSeeMe(Label(SourceDir("//rec/b/"), "anything")));
28 EXPECT_TRUE(vis.CanSeeMe(Label(SourceDir("//dir/"), "anything"))); 28 EXPECT_TRUE(vis.CanSeeMe(Label(SourceDir("//dir/"), "anything")));
29 EXPECT_FALSE(vis.CanSeeMe(Label(SourceDir("//dir/a/"), "anything"))); 29 EXPECT_FALSE(vis.CanSeeMe(Label(SourceDir("//dir/a/"), "anything")));
30 EXPECT_FALSE(vis.CanSeeMe(Label(SourceDir("//directory/"), "anything"))); 30 EXPECT_FALSE(vis.CanSeeMe(Label(SourceDir("//directory/"), "anything")));
31 } 31 }
32 32
33 TEST(Visibility, Public) { 33 TEST(Visibility, Public) {
34 Err err; 34 Err err;
35 Visibility vis; 35 Visibility vis;
36 ASSERT_TRUE(vis.Set(SourceDir("//"), Value(NULL, "*"), &err)); 36
37 Value list(NULL, Value::LIST);
38 list.list_value().push_back(Value(NULL, "*"));
39 ASSERT_TRUE(vis.Set(SourceDir("//"), list, &err));
37 40
38 EXPECT_TRUE(vis.CanSeeMe(Label(SourceDir("//random/"), "thing"))); 41 EXPECT_TRUE(vis.CanSeeMe(Label(SourceDir("//random/"), "thing")));
39 EXPECT_TRUE(vis.CanSeeMe(Label(SourceDir("//"), ""))); 42 EXPECT_TRUE(vis.CanSeeMe(Label(SourceDir("//"), "")));
40 } 43 }
41 44
42 TEST(Visibility, Private) { 45 TEST(Visibility, Private) {
43 Err err; 46 Err err;
44 Visibility vis; 47 Visibility vis;
45 ASSERT_TRUE(vis.Set(SourceDir("//"), Value(NULL, Value::LIST), &err)); 48 ASSERT_TRUE(vis.Set(SourceDir("//"), Value(NULL, Value::LIST), &err));
46 49
47 EXPECT_FALSE(vis.CanSeeMe(Label(SourceDir("//random/"), "thing"))); 50 EXPECT_FALSE(vis.CanSeeMe(Label(SourceDir("//random/"), "thing")));
48 EXPECT_FALSE(vis.CanSeeMe(Label(SourceDir("//"), ""))); 51 EXPECT_FALSE(vis.CanSeeMe(Label(SourceDir("//"), "")));
49 } 52 }
OLDNEW
« no previous file with comments | « tools/gn/visibility.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698