| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |