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

Unified Diff: chrome/common/chrome_content_client_unittest.cc

Issue 1261333004: Add support for Flash Player Component updates on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix up bauerb's final few comments. Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/chrome_content_client_unittest.cc
diff --git a/chrome/common/chrome_content_client_unittest.cc b/chrome/common/chrome_content_client_unittest.cc
index 42514d7d9cd3eb31e77616737f38882591d0ea11..5fa08bf3daafc21962ba13ac445cbdfaf07960d2 100644
--- a/chrome/common/chrome_content_client_unittest.cc
+++ b/chrome/common/chrome_content_client_unittest.cc
@@ -5,6 +5,8 @@
#include "chrome/common/chrome_content_client.h"
#include "base/command_line.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
#include "base/strings/string_split.h"
#include "content/public/common/content_switches.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -81,4 +83,42 @@ TEST(ChromeContentClientTest, Basic) {
#endif
}
+#if defined(ENABLE_PLUGINS)
+TEST(ChromeContentClientTest, FindMostRecent) {
+ ScopedVector<content::PepperPluginInfo> vector1;
+ // Test an empty vector.
+ EXPECT_EQ(ChromeContentClient::FindMostRecentPlugin(vector1.get()), nullptr);
+
+ // Now test the vector with one element.
+ content::PepperPluginInfo* info1 = new content::PepperPluginInfo();
+ info1->version = "1.0.0.0";
+ vector1.push_back(info1);
+ EXPECT_EQ(ChromeContentClient::FindMostRecentPlugin(vector1.get()), info1);
+
+ // Now do the generic test of a complex vector.
+ content::PepperPluginInfo* info2 = new content::PepperPluginInfo();
+ info2->version = "2.0.0.1";
+ content::PepperPluginInfo* info3 = new content::PepperPluginInfo();
+ info3->version = "3.5.6.7";
+ content::PepperPluginInfo* info4 = new content::PepperPluginInfo();
+ info4->version = "4.0.0.153";
+ content::PepperPluginInfo* info5 = new content::PepperPluginInfo();
+ info5->version = "5.0.12.1";
+ content::PepperPluginInfo* info6_12 = new content::PepperPluginInfo();
+ info6_12->version = "6.0.0.12";
+ content::PepperPluginInfo* info6_13 = new content::PepperPluginInfo();
+ info6_13->version = "6.0.0.13";
+
+ ScopedVector<content::PepperPluginInfo> vector2;
+ vector2.push_back(info4);
+ vector2.push_back(info2);
+ vector2.push_back(info6_13);
+ vector2.push_back(info3);
+ vector2.push_back(info5);
+ vector2.push_back(info6_12);
+
+ EXPECT_EQ(ChromeContentClient::FindMostRecentPlugin(vector2.get()), info6_13);
+}
+#endif // defined(ENABLE_PLUGINS)
+
} // namespace chrome_common

Powered by Google App Engine
This is Rietveld 408576698