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

Side by Side Diff: extensions/common/features/simple_feature_unittest.cc

Issue 404883002: Allow extension APIs to be called from WebUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android compile Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « extensions/common/features/simple_feature.cc ('k') | extensions/renderer/dispatcher.cc » ('j') | 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 "extensions/common/features/simple_feature.h" 5 #include "extensions/common/features/simple_feature.h"
6 6
7 #include "chrome/common/extensions/features/chrome_channel_feature_filter.h" 7 #include "chrome/common/extensions/features/chrome_channel_feature_filter.h"
8 #include "chrome/common/extensions/features/feature_channel.h" 8 #include "chrome/common/extensions/features/feature_channel.h"
9 #include "extensions/common/value_builder.h" 9 #include "extensions/common/value_builder.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 } 544 }
545 545
546 TEST_F(ExtensionSimpleFeatureTest, ParseContexts) { 546 TEST_F(ExtensionSimpleFeatureTest, ParseContexts) {
547 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); 547 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
548 base::ListValue* contexts = new base::ListValue(); 548 base::ListValue* contexts = new base::ListValue();
549 contexts->Append(new base::StringValue("blessed_extension")); 549 contexts->Append(new base::StringValue("blessed_extension"));
550 contexts->Append(new base::StringValue("unblessed_extension")); 550 contexts->Append(new base::StringValue("unblessed_extension"));
551 contexts->Append(new base::StringValue("content_script")); 551 contexts->Append(new base::StringValue("content_script"));
552 contexts->Append(new base::StringValue("web_page")); 552 contexts->Append(new base::StringValue("web_page"));
553 contexts->Append(new base::StringValue("blessed_web_page")); 553 contexts->Append(new base::StringValue("blessed_web_page"));
554 contexts->Append(new base::StringValue("webui"));
554 value->Set("contexts", contexts); 555 value->Set("contexts", contexts);
555 scoped_ptr<SimpleFeature> feature(new SimpleFeature()); 556 scoped_ptr<SimpleFeature> feature(new SimpleFeature());
556 feature->Parse(value.get()); 557 feature->Parse(value.get());
557 EXPECT_EQ(5u, feature->contexts()->size()); 558 EXPECT_EQ(6u, feature->contexts()->size());
558 EXPECT_TRUE(feature->contexts()->count(Feature::BLESSED_EXTENSION_CONTEXT)); 559 EXPECT_TRUE(feature->contexts()->count(Feature::BLESSED_EXTENSION_CONTEXT));
559 EXPECT_TRUE(feature->contexts()->count(Feature::UNBLESSED_EXTENSION_CONTEXT)); 560 EXPECT_TRUE(feature->contexts()->count(Feature::UNBLESSED_EXTENSION_CONTEXT));
560 EXPECT_TRUE(feature->contexts()->count(Feature::CONTENT_SCRIPT_CONTEXT)); 561 EXPECT_TRUE(feature->contexts()->count(Feature::CONTENT_SCRIPT_CONTEXT));
561 EXPECT_TRUE(feature->contexts()->count(Feature::WEB_PAGE_CONTEXT)); 562 EXPECT_TRUE(feature->contexts()->count(Feature::WEB_PAGE_CONTEXT));
562 EXPECT_TRUE(feature->contexts()->count(Feature::BLESSED_WEB_PAGE_CONTEXT)); 563 EXPECT_TRUE(feature->contexts()->count(Feature::BLESSED_WEB_PAGE_CONTEXT));
563 564
564 value->SetString("contexts", "all"); 565 value->SetString("contexts", "all");
565 scoped_ptr<SimpleFeature> feature2(new SimpleFeature()); 566 scoped_ptr<SimpleFeature> feature2(new SimpleFeature());
566 feature2->Parse(value.get()); 567 feature2->Parse(value.get());
567 EXPECT_EQ(*(feature->contexts()), *(feature2->contexts())); 568 EXPECT_EQ(*(feature->contexts()), *(feature2->contexts()));
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 IsAvailableInChannel("trunk", VersionInfo::CHANNEL_CANARY)); 742 IsAvailableInChannel("trunk", VersionInfo::CHANNEL_CANARY));
742 EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL, 743 EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL,
743 IsAvailableInChannel("trunk", VersionInfo::CHANNEL_DEV)); 744 IsAvailableInChannel("trunk", VersionInfo::CHANNEL_DEV));
744 EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL, 745 EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL,
745 IsAvailableInChannel("trunk", VersionInfo::CHANNEL_BETA)); 746 IsAvailableInChannel("trunk", VersionInfo::CHANNEL_BETA));
746 EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL, 747 EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL,
747 IsAvailableInChannel("trunk", VersionInfo::CHANNEL_STABLE)); 748 IsAvailableInChannel("trunk", VersionInfo::CHANNEL_STABLE));
748 } 749 }
749 750
750 } // namespace extensions 751 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/features/simple_feature.cc ('k') | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698