OLD | NEW |
1 // Copyright (c) 2006-2009 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> |
| 9 #include <vector> |
8 | 10 |
9 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
10 #include "base/file_util.h" | 12 #include "base/file_util.h" |
11 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
12 #include "base/path_service.h" | 14 #include "base/path_service.h" |
13 #include "base/process_util.h" | 15 #include "base/process_util.h" |
14 #include "base/ref_counted.h" | 16 #include "base/ref_counted.h" |
15 #include "base/scoped_handle.h" | 17 #include "base/scoped_handle.h" |
16 #include "base/task.h" | 18 #include "base/task.h" |
17 #include "base/win_util.h" | 19 #include "base/win_util.h" |
18 #include "net/base/net_util.h" | 20 #include "net/base/net_util.h" |
19 | 21 |
20 #include "chrome_frame/test/chrome_frame_unittests.h" | 22 #include "chrome_frame/test/chrome_frame_unittests.h" |
21 #include "chrome_frame/chrome_frame_automation.h" | 23 #include "chrome_frame/chrome_frame_automation.h" |
22 #include "chrome_frame/chrome_frame_delegate.h" | 24 #include "chrome_frame/chrome_frame_delegate.h" |
23 #include "chrome_frame/html_utils.h" | 25 #include "chrome_frame/html_utils.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 27 #include "chrome/browser/automation/url_request_automation_job.h" |
25 | 28 |
26 const char kChromeFrameUserAgent[] = "chromeframe"; | 29 const char kChromeFrameUserAgent[] = "chromeframe"; |
27 | 30 |
28 class HtmlUtilUnittest : public testing::Test { | 31 class HtmlUtilUnittest : public testing::Test { |
29 protected: | 32 protected: |
30 // Constructor | 33 // Constructor |
31 HtmlUtilUnittest() {} | 34 HtmlUtilUnittest() {} |
32 | 35 |
33 // Returns the test path given a test case. | 36 // Returns the test path given a test case. |
34 virtual bool GetTestPath(const std::wstring& test_case, std::wstring* path) { | 37 virtual bool GetTestPath(const std::wstring& test_case, std::wstring* path) { |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 "X-Frame-Options: SAMEORIGIN\r\n")); | 356 "X-Frame-Options: SAMEORIGIN\r\n")); |
354 EXPECT_TRUE(http_utils::HasFrameBustingHeader( | 357 EXPECT_TRUE(http_utils::HasFrameBustingHeader( |
355 "X-Frame-Options: deny\r\n" | 358 "X-Frame-Options: deny\r\n" |
356 "X-Frame-Options: ALLOWall\r\n" | 359 "X-Frame-Options: ALLOWall\r\n" |
357 "Content-Length: 42\r\n")); | 360 "Content-Length: 42\r\n")); |
358 EXPECT_TRUE(http_utils::HasFrameBustingHeader( | 361 EXPECT_TRUE(http_utils::HasFrameBustingHeader( |
359 "X-Frame-Options: SAMEORIGIN\r\n" | 362 "X-Frame-Options: SAMEORIGIN\r\n" |
360 "X-Frame-Options: ALLOWall\r\n")); | 363 "X-Frame-Options: ALLOWall\r\n")); |
361 } | 364 } |
362 | 365 |
| 366 TEST(HttpCookieTest, IdentifyDuplicateCookieTest) { |
| 367 std::vector<std::string> header_cookies; |
| 368 header_cookies.push_back("BLAHHH; Path=/;"); |
363 | 369 |
| 370 EXPECT_FALSE(URLRequestAutomationJob::IsCookiePresentInCookieHeader( |
| 371 "BLAHHH=1", header_cookies)); |
| 372 |
| 373 header_cookies.clear(); |
| 374 |
| 375 header_cookies.push_back("BLAHHH=1; Path=/;"); |
| 376 |
| 377 EXPECT_TRUE(URLRequestAutomationJob::IsCookiePresentInCookieHeader( |
| 378 "BLAHHH=1", header_cookies)); |
| 379 |
| 380 header_cookies.clear(); |
| 381 |
| 382 header_cookies.push_back("BLAH=1; Path=/blah;"); |
| 383 |
| 384 EXPECT_FALSE(URLRequestAutomationJob::IsCookiePresentInCookieHeader( |
| 385 "BLAH", header_cookies)); |
| 386 } |
| 387 |
OLD | NEW |