| OLD | NEW |
| 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 <string.h> | |
| 8 | |
| 9 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 10 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 12 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| 13 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
| 14 #include "extensions/common/constants.h" | |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "url/gurl.h" | |
| 17 #include "url/origin.h" | |
| 18 #include "url/url_util.h" | |
| 19 | 13 |
| 20 namespace { | 14 namespace { |
| 21 | 15 |
| 22 void CheckUserAgentStringOrdering(bool mobile_device) { | 16 void CheckUserAgentStringOrdering(bool mobile_device) { |
| 23 std::vector<std::string> pieces; | 17 std::vector<std::string> pieces; |
| 24 | 18 |
| 25 // 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. |
| 26 ChromeContentClient content_client; | 20 ChromeContentClient content_client; |
| 27 std::string buffer = content_client.GetUserAgent(); | 21 std::string buffer = content_client.GetUserAgent(); |
| 28 | 22 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 vector2.push_back(info2); | 114 vector2.push_back(info2); |
| 121 vector2.push_back(info6_13); | 115 vector2.push_back(info6_13); |
| 122 vector2.push_back(info3); | 116 vector2.push_back(info3); |
| 123 vector2.push_back(info5); | 117 vector2.push_back(info5); |
| 124 vector2.push_back(info6_12); | 118 vector2.push_back(info6_12); |
| 125 | 119 |
| 126 EXPECT_EQ(ChromeContentClient::FindMostRecentPlugin(vector2.get()), info6_13); | 120 EXPECT_EQ(ChromeContentClient::FindMostRecentPlugin(vector2.get()), info6_13); |
| 127 } | 121 } |
| 128 #endif // defined(ENABLE_PLUGINS) | 122 #endif // defined(ENABLE_PLUGINS) |
| 129 | 123 |
| 130 TEST(ChromeContentClientTest, AdditionalSchemes) { | |
| 131 EXPECT_TRUE(url::IsStandard( | |
| 132 extensions::kExtensionScheme, | |
| 133 url::Component(0, strlen(extensions::kExtensionScheme)))); | |
| 134 | |
| 135 GURL extension_url( | |
| 136 "chrome-extension://abcdefghijklmnopqrstuvwxyzabcdef/foo.html"); | |
| 137 url::Origin origin(extension_url); | |
| 138 EXPECT_EQ("chrome-extension://abcdefghijklmnopqrstuvwxyzabcdef", | |
| 139 origin.Serialize()); | |
| 140 } | |
| 141 | |
| 142 } // namespace chrome_common | 124 } // namespace chrome_common |
| OLD | NEW |