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 |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
10 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
11 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
| 14 #include "extensions/common/constants.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "url/gurl.h" |
| 17 #include "url/origin.h" |
| 18 #include "url/url_util.h" |
13 | 19 |
14 namespace { | 20 namespace { |
15 | 21 |
16 void CheckUserAgentStringOrdering(bool mobile_device) { | 22 void CheckUserAgentStringOrdering(bool mobile_device) { |
17 std::vector<std::string> pieces; | 23 std::vector<std::string> pieces; |
18 | 24 |
19 // Check if the pieces of the user agent string come in the correct order. | 25 // Check if the pieces of the user agent string come in the correct order. |
20 ChromeContentClient content_client; | 26 ChromeContentClient content_client; |
21 std::string buffer = content_client.GetUserAgent(); | 27 std::string buffer = content_client.GetUserAgent(); |
22 | 28 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 vector2.push_back(info2); | 120 vector2.push_back(info2); |
115 vector2.push_back(info6_13); | 121 vector2.push_back(info6_13); |
116 vector2.push_back(info3); | 122 vector2.push_back(info3); |
117 vector2.push_back(info5); | 123 vector2.push_back(info5); |
118 vector2.push_back(info6_12); | 124 vector2.push_back(info6_12); |
119 | 125 |
120 EXPECT_EQ(ChromeContentClient::FindMostRecentPlugin(vector2.get()), info6_13); | 126 EXPECT_EQ(ChromeContentClient::FindMostRecentPlugin(vector2.get()), info6_13); |
121 } | 127 } |
122 #endif // defined(ENABLE_PLUGINS) | 128 #endif // defined(ENABLE_PLUGINS) |
123 | 129 |
| 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 |
124 } // namespace chrome_common | 142 } // namespace chrome_common |
OLD | NEW |