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

Side by Side Diff: chrome/browser/plugin_finder_unittest.cc

Issue 10066016: Fix plug-in identifier for Shockwave and add a unit test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | « chrome/browser/plugin_finder.cc ('k') | chrome/browser/plugin_observer.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/plugin_finder.h" 5 #include "chrome/browser/plugin_finder.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "webkit/plugins/npapi/plugin_list.h"
9 10
10 using base::DictionaryValue; 11 using base::DictionaryValue;
12 using webkit::npapi::PluginGroup;
13 using webkit::npapi::PluginList;
11 14
12 TEST(PluginFinderTest, JsonSyntax) { 15 TEST(PluginFinderTest, JsonSyntax) {
13 scoped_ptr<DictionaryValue> plugin_list(PluginFinder::LoadPluginList()); 16 scoped_ptr<DictionaryValue> plugin_list(PluginFinder::LoadPluginList());
14 ASSERT_TRUE(plugin_list.get()); 17 ASSERT_TRUE(plugin_list.get());
15 for (DictionaryValue::Iterator plugin_it(*plugin_list); 18 for (DictionaryValue::Iterator plugin_it(*plugin_list);
16 plugin_it.HasNext(); plugin_it.Advance()) { 19 plugin_it.HasNext(); plugin_it.Advance()) {
17 const DictionaryValue* plugin = NULL; 20 const DictionaryValue* plugin = NULL;
18 ASSERT_TRUE(plugin_it.value().GetAsDictionary(&plugin)); 21 ASSERT_TRUE(plugin_it.value().GetAsDictionary(&plugin));
19 std::string dummy_str; 22 std::string dummy_str;
20 bool dummy_bool; 23 bool dummy_bool;
21 EXPECT_TRUE(plugin->GetString("lang", &dummy_str)); 24 EXPECT_TRUE(plugin->GetString("lang", &dummy_str));
22 EXPECT_TRUE(plugin->GetString("url", &dummy_str)); 25 EXPECT_TRUE(plugin->GetString("url", &dummy_str));
23 EXPECT_TRUE(plugin->GetString("name", &dummy_str)); 26 EXPECT_TRUE(plugin->GetString("name", &dummy_str));
24 if (plugin->HasKey("help_url")) 27 if (plugin->HasKey("help_url"))
25 EXPECT_TRUE(plugin->GetString("help_url", &dummy_str)); 28 EXPECT_TRUE(plugin->GetString("help_url", &dummy_str));
26 if (plugin->HasKey("displayurl")) 29 if (plugin->HasKey("displayurl"))
27 EXPECT_TRUE(plugin->GetBoolean("displayurl", &dummy_bool)); 30 EXPECT_TRUE(plugin->GetBoolean("displayurl", &dummy_bool));
28 if (plugin->HasKey("requires_authorization")) 31 if (plugin->HasKey("requires_authorization"))
29 EXPECT_TRUE(plugin->GetBoolean("requires_authorization", &dummy_bool)); 32 EXPECT_TRUE(plugin->GetBoolean("requires_authorization", &dummy_bool));
30 ListValue* mime_types = NULL; 33 ListValue* mime_types = NULL;
31 ASSERT_TRUE(plugin->GetList("mime_types", &mime_types)); 34 ASSERT_TRUE(plugin->GetList("mime_types", &mime_types));
32 for (ListValue::const_iterator mime_type_it = mime_types->begin(); 35 for (ListValue::const_iterator mime_type_it = mime_types->begin();
33 mime_type_it != mime_types->end(); ++mime_type_it) { 36 mime_type_it != mime_types->end(); ++mime_type_it) {
34 EXPECT_TRUE((*mime_type_it)->GetAsString(&dummy_str)); 37 EXPECT_TRUE((*mime_type_it)->GetAsString(&dummy_str));
35 } 38 }
36 } 39 }
37 } 40 }
41
42 TEST(PluginFinderTest, PluginGroups) {
43 PluginFinder plugin_finder;
44 PluginList* plugin_list = PluginList::Singleton();
45 const std::vector<PluginGroup*>& plugin_groups =
46 plugin_list->GetHardcodedPluginGroups();
47 for (std::vector<PluginGroup*>::const_iterator it = plugin_groups.begin();
48 it != plugin_groups.end(); ++it) {
49 if ((*it)->version_ranges().empty())
50 continue;
51 std::string identifier = (*it)->identifier();
52 EXPECT_TRUE(plugin_finder.FindPluginWithIdentifier(identifier)) <<
53 "Couldn't find PluginInstaller for '" << identifier << "'";
54 }
55 }
OLDNEW
« no previous file with comments | « chrome/browser/plugin_finder.cc ('k') | chrome/browser/plugin_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698