summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/plugins/npapi/mock_plugin_list.cc33
-rw-r--r--webkit/plugins/npapi/mock_plugin_list.h35
-rw-r--r--webkit/plugins/npapi/plugin_group.h6
-rw-r--r--webkit/plugins/npapi/plugin_list_unittest.cc40
-rw-r--r--webkit/tools/test_shell/test_shell.gypi12
5 files changed, 84 insertions, 42 deletions
diff --git a/webkit/plugins/npapi/mock_plugin_list.cc b/webkit/plugins/npapi/mock_plugin_list.cc
new file mode 100644
index 0000000..5280052
--- /dev/null
+++ b/webkit/plugins/npapi/mock_plugin_list.cc
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/plugins/npapi/mock_plugin_list.h"
+
+namespace webkit {
+namespace npapi {
+
+MockPluginList::MockPluginList(const PluginGroupDefinition* group_definitions,
+ size_t num_group_definitions) :
+ PluginList(group_definitions, num_group_definitions) {
+}
+
+MockPluginList::~MockPluginList() {
+}
+
+void MockPluginList::AddPluginToLoad(const WebPluginInfo& plugin) {
+ plugins_to_load_.push_back(plugin);
+}
+
+void MockPluginList::ClearPluginsToLoad() {
+ plugins_to_load_.clear();
+}
+
+void MockPluginList::LoadPluginsInternal(
+ ScopedVector<PluginGroup>* plugin_groups) {
+ for (size_t i = 0; i < plugins_to_load_.size(); ++i)
+ AddToPluginGroups(plugins_to_load_[i], plugin_groups);
+}
+
+} // npapi
+} // webkit
diff --git a/webkit/plugins/npapi/mock_plugin_list.h b/webkit/plugins/npapi/mock_plugin_list.h
new file mode 100644
index 0000000..15c11c9
--- /dev/null
+++ b/webkit/plugins/npapi/mock_plugin_list.h
@@ -0,0 +1,35 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_PLUGINS_NPAPI_MOCK_PLUGIN_LIST_H_
+#define WEBKIT_PLUGINS_NPAPI_MOCK_PLUGIN_LIST_H_
+
+#include "webkit/plugins/npapi/plugin_list.h"
+
+namespace webkit {
+namespace npapi {
+
+// A PluginList for tests that avoids file system IO. There is also no reason
+// to use |lock_| (but it doesn't hurt either).
+class MockPluginList : public PluginList {
+ public:
+ MockPluginList(const PluginGroupDefinition* group_definitions,
+ size_t num_group_definitions);
+ virtual ~MockPluginList();
+
+ void AddPluginToLoad(const WebPluginInfo& plugin);
+ void ClearPluginsToLoad();
+
+ private:
+ std::vector<WebPluginInfo> plugins_to_load_;
+
+ // PluginList methods:
+ virtual void LoadPluginsInternal(
+ ScopedVector<PluginGroup>* plugin_groups) OVERRIDE;
+};
+
+} // npapi
+} // webkit
+
+#endif // WEBKIT_PLUGINS_NPAPI_MOCK_PLUGIN_LIST_H_
diff --git a/webkit/plugins/npapi/plugin_group.h b/webkit/plugins/npapi/plugin_group.h
index deb8461..fd0f8e3 100644
--- a/webkit/plugins/npapi/plugin_group.h
+++ b/webkit/plugins/npapi/plugin_group.h
@@ -26,9 +26,7 @@ namespace webkit {
namespace npapi {
class PluginList;
-namespace plugin_test_internal {
-class PluginListWithoutFileIO;
-}
+class MockPluginList;
// Hard-coded version ranges for plugin groups.
struct VersionRangeDefinition {
@@ -202,7 +200,7 @@ class PluginGroup {
private:
friend class PluginList;
- friend class plugin_test_internal::PluginListWithoutFileIO;
+ friend class MockPluginList;
friend class PluginGroupTest;
friend class ::TableModelArrayControllerTest;
friend class ::PluginExceptionsTableModelTest;
diff --git a/webkit/plugins/npapi/plugin_list_unittest.cc b/webkit/plugins/npapi/plugin_list_unittest.cc
index d037e38..785fc3c 100644
--- a/webkit/plugins/npapi/plugin_list_unittest.cc
+++ b/webkit/plugins/npapi/plugin_list_unittest.cc
@@ -6,47 +6,11 @@
#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "webkit/plugins/npapi/mock_plugin_list.h"
namespace webkit {
namespace npapi {
-namespace plugin_test_internal {
-
-// A PluginList for tests that avoids file system IO. There is also no reason
-// to use |lock_| (but it doesn't hurt either).
-class PluginListWithoutFileIO : public PluginList {
- public:
- PluginListWithoutFileIO(const PluginGroupDefinition* group_definitions,
- size_t num_group_definitions) :
- PluginList(group_definitions, num_group_definitions) {}
- virtual ~PluginListWithoutFileIO() {}
-
- void AddPluginToLoad(const WebPluginInfo& plugin) {
- plugins_to_load_.push_back(plugin);
- }
-
- void ClearPluginsToLoad() {
- plugins_to_load_.clear();
- }
-
- void AddPluginGroupDefinition(const PluginGroupDefinition& definition) {
- hardcoded_definitions_.push_back(definition);
- }
-
- private:
- std::vector<WebPluginInfo> plugins_to_load_;
- std::vector<PluginGroupDefinition> hardcoded_definitions_;
-
- // PluginList methods:
- virtual void LoadPluginsInternal(
- ScopedVector<PluginGroup>* plugin_groups) OVERRIDE {
- for (size_t i = 0; i < plugins_to_load_.size(); ++i)
- AddToPluginGroups(plugins_to_load_[i], plugin_groups);
- }
-};
-
-} // namespace plugin_test_internal
-
namespace {
bool Equals(const WebPluginInfo& a, const WebPluginInfo& b,
@@ -103,7 +67,7 @@ class PluginListTest : public testing::Test {
}
protected:
- plugin_test_internal::PluginListWithoutFileIO plugin_list_;
+ MockPluginList plugin_list_;
WebPluginInfo foo_plugin_;
WebPluginInfo bar_plugin_;
};
diff --git a/webkit/tools/test_shell/test_shell.gypi b/webkit/tools/test_shell/test_shell.gypi
index 3cf6adc..37abb01 100644
--- a/webkit/tools/test_shell/test_shell.gypi
+++ b/webkit/tools/test_shell/test_shell.gypi
@@ -331,6 +331,17 @@
],
},
{
+ 'target_name': 'test_shell_test_support',
+ 'type': 'static_library',
+ 'dependencies': [
+ '<(DEPTH)/webkit/support/webkit_support.gyp:glue'
+ ],
+ 'sources': [
+ '../../plugins/npapi/mock_plugin_list.cc',
+ '../../plugins/npapi/mock_plugin_list.h',
+ ]
+ },
+ {
'target_name': 'test_shell_tests',
'type': 'executable',
'variables': {
@@ -343,6 +354,7 @@
],
'dependencies': [
'test_shell_common',
+ 'test_shell_test_support',
'<(DEPTH)/base/base.gyp:test_support_base',
'<(DEPTH)/media/media.gyp:media_test_support',
'<(DEPTH)/net/net.gyp:net',