| 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 "extensions/common/features/simple_feature.h" | 5 #include "extensions/common/features/simple_feature.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 | 554 |
| 555 TEST_F(SimpleFeatureTest, ParseContexts) { | 555 TEST_F(SimpleFeatureTest, ParseContexts) { |
| 556 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 556 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 557 base::ListValue* contexts = new base::ListValue(); | 557 base::ListValue* contexts = new base::ListValue(); |
| 558 contexts->Append(new base::StringValue("blessed_extension")); | 558 contexts->Append(new base::StringValue("blessed_extension")); |
| 559 contexts->Append(new base::StringValue("unblessed_extension")); | 559 contexts->Append(new base::StringValue("unblessed_extension")); |
| 560 contexts->Append(new base::StringValue("content_script")); | 560 contexts->Append(new base::StringValue("content_script")); |
| 561 contexts->Append(new base::StringValue("web_page")); | 561 contexts->Append(new base::StringValue("web_page")); |
| 562 contexts->Append(new base::StringValue("blessed_web_page")); | 562 contexts->Append(new base::StringValue("blessed_web_page")); |
| 563 contexts->Append(new base::StringValue("webui")); | 563 contexts->Append(new base::StringValue("webui")); |
| 564 contexts->Append(new base::StringValue("extension_service_worker")); |
| 564 value->Set("contexts", contexts); | 565 value->Set("contexts", contexts); |
| 565 std::unique_ptr<SimpleFeature> feature(new SimpleFeature()); | 566 std::unique_ptr<SimpleFeature> feature(new SimpleFeature()); |
| 566 feature->Parse(value.get()); | 567 feature->Parse(value.get()); |
| 567 EXPECT_EQ(6u, feature->contexts()->size()); | 568 EXPECT_EQ(7u, feature->contexts()->size()); |
| 568 EXPECT_TRUE( | 569 EXPECT_TRUE( |
| 569 STLCount(*(feature->contexts()), Feature::BLESSED_EXTENSION_CONTEXT)); | 570 STLCount(*(feature->contexts()), Feature::BLESSED_EXTENSION_CONTEXT)); |
| 570 EXPECT_TRUE( | 571 EXPECT_TRUE( |
| 571 STLCount(*(feature->contexts()), Feature::UNBLESSED_EXTENSION_CONTEXT)); | 572 STLCount(*(feature->contexts()), Feature::UNBLESSED_EXTENSION_CONTEXT)); |
| 572 EXPECT_TRUE( | 573 EXPECT_TRUE( |
| 573 STLCount(*(feature->contexts()), Feature::CONTENT_SCRIPT_CONTEXT)); | 574 STLCount(*(feature->contexts()), Feature::CONTENT_SCRIPT_CONTEXT)); |
| 574 EXPECT_TRUE( | 575 EXPECT_TRUE( |
| 575 STLCount(*(feature->contexts()), Feature::WEB_PAGE_CONTEXT)); | 576 STLCount(*(feature->contexts()), Feature::WEB_PAGE_CONTEXT)); |
| 576 EXPECT_TRUE( | 577 EXPECT_TRUE( |
| 577 STLCount(*(feature->contexts()), Feature::BLESSED_WEB_PAGE_CONTEXT)); | 578 STLCount(*(feature->contexts()), Feature::BLESSED_WEB_PAGE_CONTEXT)); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 EXPECT_FALSE(SimpleFeature::IsIdInArray("", kIdArray, arraysize(kIdArray))); | 737 EXPECT_FALSE(SimpleFeature::IsIdInArray("", kIdArray, arraysize(kIdArray))); |
| 737 EXPECT_FALSE(SimpleFeature::IsIdInArray( | 738 EXPECT_FALSE(SimpleFeature::IsIdInArray( |
| 738 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", kIdArray, arraysize(kIdArray))); | 739 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", kIdArray, arraysize(kIdArray))); |
| 739 EXPECT_TRUE(SimpleFeature::IsIdInArray( | 740 EXPECT_TRUE(SimpleFeature::IsIdInArray( |
| 740 "bbbbccccdddddddddeeeeeeffffgghhh", kIdArray, arraysize(kIdArray))); | 741 "bbbbccccdddddddddeeeeeeffffgghhh", kIdArray, arraysize(kIdArray))); |
| 741 EXPECT_TRUE(SimpleFeature::IsIdInArray( | 742 EXPECT_TRUE(SimpleFeature::IsIdInArray( |
| 742 "aaaabbbbccccddddeeeeffffgggghhhh", kIdArray, arraysize(kIdArray))); | 743 "aaaabbbbccccddddeeeeffffgggghhhh", kIdArray, arraysize(kIdArray))); |
| 743 } | 744 } |
| 744 | 745 |
| 745 } // namespace extensions | 746 } // namespace extensions |
| OLD | NEW |