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

Side by Side 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: Further refinements. 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 unified diff | Download patch
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/common/chrome_content_client.h" 5 #include "chrome/common/chrome_content_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h"
8 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
9 #include "content/public/common/content_switches.h" 11 #include "content/public/common/content_switches.h"
10 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
11 13
12 namespace { 14 namespace {
13 15
14 void CheckUserAgentStringOrdering(bool mobile_device) { 16 void CheckUserAgentStringOrdering(bool mobile_device) {
15 std::vector<std::string> pieces; 17 std::vector<std::string> pieces;
16 18
17 // Check if the pieces of the user agent string come in the correct order. 19 // Check if the pieces of the user agent string come in the correct order.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 ASSERT_FALSE(command_line->HasSwitch(switches::kUseMobileUserAgent)); 76 ASSERT_FALSE(command_line->HasSwitch(switches::kUseMobileUserAgent));
75 CheckUserAgentStringOrdering(false); 77 CheckUserAgentStringOrdering(false);
76 78
77 // Do it for mobile devices. 79 // Do it for mobile devices.
78 command_line->AppendSwitch(switches::kUseMobileUserAgent); 80 command_line->AppendSwitch(switches::kUseMobileUserAgent);
79 ASSERT_TRUE(command_line->HasSwitch(switches::kUseMobileUserAgent)); 81 ASSERT_TRUE(command_line->HasSwitch(switches::kUseMobileUserAgent));
80 CheckUserAgentStringOrdering(true); 82 CheckUserAgentStringOrdering(true);
81 #endif 83 #endif
82 } 84 }
83 85
86 #if defined(ENABLE_PLUGINS)
87 TEST(ChromeContentClientTest, FindMostRecent) {
88 ScopedVector<content::PepperPluginInfo> vector1;
89 // Test an empty vector.
90 EXPECT_EQ(ChromeContentClient::FindMostRecentPlugin(vector1.get()), nullptr);
91
92 // Now test the vector with one element.
93 content::PepperPluginInfo* info1 = new content::PepperPluginInfo();
94 info1->version = "1.0.0.0";
95 vector1.push_back(info1);
96 EXPECT_EQ(ChromeContentClient::FindMostRecentPlugin(vector1.get()), info1);
97
98 // Now do the generic test of a complex vector.
99 content::PepperPluginInfo* info2 = new content::PepperPluginInfo();
100 info2->version = "2.0.0.1";
101 content::PepperPluginInfo* info3 = new content::PepperPluginInfo();
102 info3->version = "3.5.6.7";
103 content::PepperPluginInfo* info4 = new content::PepperPluginInfo();
104 info4->version = "4.0.0.153";
105 content::PepperPluginInfo* info5 = new content::PepperPluginInfo();
106 info5->version = "5.0.12.1";
107 content::PepperPluginInfo* info6_12 = new content::PepperPluginInfo();
108 info6_12->version = "6.0.0.12";
109 content::PepperPluginInfo* info6_13 = new content::PepperPluginInfo();
110 info6_13->version = "6.0.0.13";
111
112 ScopedVector<content::PepperPluginInfo> vector2;
113 vector2.push_back(info4);
114 vector2.push_back(info2);
115 vector2.push_back(info6_13);
116 vector2.push_back(info3);
117 vector2.push_back(info5);
118 vector2.push_back(info6_12);
119
120 EXPECT_EQ(ChromeContentClient::FindMostRecentPlugin(vector2.get()), info6_13);
121 }
122 #endif // defined(ENABLE_PLUGINS)
123
84 } // namespace chrome_common 124 } // namespace chrome_common
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698