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