OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 <windows.h> | 5 #include <windows.h> |
6 #include <atlsecurity.h> | 6 #include <atlsecurity.h> |
7 #include <shellapi.h> | 7 #include <shellapi.h> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 // tag if we've already added it. | 285 // tag if we've already added it. |
286 for (int i = 0; i < arraysize(test_cases); ++i) { | 286 for (int i = 0; i < arraysize(test_cases); ++i) { |
287 std::string ua(test_cases[i].expected_); | 287 std::string ua(test_cases[i].expected_); |
288 std::string new_ua(http_utils::AddChromeFrameToUserAgentValue(ua)); | 288 std::string new_ua(http_utils::AddChromeFrameToUserAgentValue(ua)); |
289 EXPECT_EQ(test_cases[i].expected_, new_ua); | 289 EXPECT_EQ(test_cases[i].expected_, new_ua); |
290 } | 290 } |
291 } | 291 } |
292 | 292 |
293 TEST_F(HtmlUtilUnittest, GetDefaultUserAgentHeaderWithCFTag) { | 293 TEST_F(HtmlUtilUnittest, GetDefaultUserAgentHeaderWithCFTag) { |
294 std::string ua(http_utils::GetDefaultUserAgentHeaderWithCFTag()); | 294 std::string ua(http_utils::GetDefaultUserAgentHeaderWithCFTag()); |
295 EXPECT_NE(0u, ua.length()); | 295 EXPECT_NE(0, ua.length()); |
296 EXPECT_NE(std::string::npos, ua.find("Mozilla")); | 296 EXPECT_NE(std::string::npos, ua.find("Mozilla")); |
297 EXPECT_NE(std::string::npos, ua.find(kChromeFrameUserAgent)); | 297 EXPECT_NE(std::string::npos, ua.find(kChromeFrameUserAgent)); |
298 } | 298 } |
299 | 299 |
300 TEST_F(HtmlUtilUnittest, GetDefaultUserAgent) { | 300 TEST_F(HtmlUtilUnittest, GetDefaultUserAgent) { |
301 std::string ua(http_utils::GetDefaultUserAgent()); | 301 std::string ua(http_utils::GetDefaultUserAgent()); |
302 EXPECT_NE(0u, ua.length()); | 302 EXPECT_NE(0, ua.length()); |
303 EXPECT_NE(std::string::npos, ua.find("Mozilla")); | 303 EXPECT_NE(std::string::npos, ua.find("Mozilla")); |
304 } | 304 } |
305 | 305 |
306 TEST_F(HtmlUtilUnittest, GetChromeFrameUserAgent) { | 306 TEST_F(HtmlUtilUnittest, GetChromeFrameUserAgent) { |
307 const char* call1 = http_utils::GetChromeFrameUserAgent(); | 307 const char* call1 = http_utils::GetChromeFrameUserAgent(); |
308 const char* call2 = http_utils::GetChromeFrameUserAgent(); | 308 const char* call2 = http_utils::GetChromeFrameUserAgent(); |
309 // Expect static buffer since caller does no cleanup. | 309 // Expect static buffer since caller does no cleanup. |
310 EXPECT_EQ(call1, call2); | 310 EXPECT_EQ(call1, call2); |
311 std::string ua(call1); | 311 std::string ua(call1); |
312 EXPECT_EQ("chromeframe/0.0.0.0", ua); | 312 EXPECT_EQ("chromeframe/0.0.0.0", ua); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 "X-Frame-Options: SAMEORIGIN\r\n")); | 362 "X-Frame-Options: SAMEORIGIN\r\n")); |
363 EXPECT_TRUE(http_utils::HasFrameBustingHeader( | 363 EXPECT_TRUE(http_utils::HasFrameBustingHeader( |
364 "X-Frame-Options: deny\r\n" | 364 "X-Frame-Options: deny\r\n" |
365 "X-Frame-Options: ALLOWall\r\n" | 365 "X-Frame-Options: ALLOWall\r\n" |
366 "Content-Length: 42\r\n")); | 366 "Content-Length: 42\r\n")); |
367 EXPECT_TRUE(http_utils::HasFrameBustingHeader( | 367 EXPECT_TRUE(http_utils::HasFrameBustingHeader( |
368 "X-Frame-Options: SAMEORIGIN\r\n" | 368 "X-Frame-Options: SAMEORIGIN\r\n" |
369 "X-Frame-Options: ALLOWall\r\n")); | 369 "X-Frame-Options: ALLOWall\r\n")); |
370 } | 370 } |
371 | 371 |
OLD | NEW |