| 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_frame/test/chrome_frame_test_utils.h" | 5 #include "chrome_frame/test/chrome_frame_test_utils.h" |
| 6 | 6 |
| 7 #include <atlapp.h> | 7 #include <atlapp.h> |
| 8 #include <atlmisc.h> | 8 #include <atlmisc.h> |
| 9 #include <iepmapi.h> | 9 #include <iepmapi.h> |
| 10 #include <sddl.h> | 10 #include <sddl.h> |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 505 |
| 506 base::FilePath GetSeleniumTestFolder() { | 506 base::FilePath GetSeleniumTestFolder() { |
| 507 base::FilePath test_dir; | 507 base::FilePath test_dir; |
| 508 PathService::Get(base::DIR_SOURCE_ROOT, &test_dir); | 508 PathService::Get(base::DIR_SOURCE_ROOT, &test_dir); |
| 509 test_dir = test_dir.Append(FILE_PATH_LITERAL("data")) | 509 test_dir = test_dir.Append(FILE_PATH_LITERAL("data")) |
| 510 .Append(FILE_PATH_LITERAL("selenium_core")); | 510 .Append(FILE_PATH_LITERAL("selenium_core")); |
| 511 return test_dir; | 511 return test_dir; |
| 512 } | 512 } |
| 513 | 513 |
| 514 std::wstring GetPathFromUrl(const std::wstring& url) { | 514 std::wstring GetPathFromUrl(const std::wstring& url) { |
| 515 base::string16 url16 = WideToUTF16(url); | 515 base::string16 url16 = base::WideToUTF16(url); |
| 516 GURL gurl = GURL(url16); | 516 GURL gurl = GURL(url16); |
| 517 if (gurl.has_query()) { | 517 if (gurl.has_query()) { |
| 518 GURL::Replacements replacements; | 518 GURL::Replacements replacements; |
| 519 replacements.ClearQuery(); | 519 replacements.ClearQuery(); |
| 520 gurl = gurl.ReplaceComponents(replacements); | 520 gurl = gurl.ReplaceComponents(replacements); |
| 521 } | 521 } |
| 522 return UTF8ToWide(gurl.PathForRequest()); | 522 return base::UTF8ToWide(gurl.PathForRequest()); |
| 523 } | 523 } |
| 524 | 524 |
| 525 std::wstring GetPathAndQueryFromUrl(const std::wstring& url) { | 525 std::wstring GetPathAndQueryFromUrl(const std::wstring& url) { |
| 526 base::string16 url16 = WideToUTF16(url); | 526 base::string16 url16 = base::WideToUTF16(url); |
| 527 GURL gurl = GURL(url16); | 527 GURL gurl = GURL(url16); |
| 528 return UTF8ToWide(gurl.PathForRequest()); | 528 return base::UTF8ToWide(gurl.PathForRequest()); |
| 529 } | 529 } |
| 530 | 530 |
| 531 std::wstring GetClipboardText() { | 531 std::wstring GetClipboardText() { |
| 532 base::string16 text16; | 532 base::string16 text16; |
| 533 ui::Clipboard::GetForCurrentThread()->ReadText( | 533 ui::Clipboard::GetForCurrentThread()->ReadText( |
| 534 ui::CLIPBOARD_TYPE_COPY_PASTE, &text16); | 534 ui::CLIPBOARD_TYPE_COPY_PASTE, &text16); |
| 535 return UTF16ToWide(text16); | 535 return base::UTF16ToWide(text16); |
| 536 } | 536 } |
| 537 | 537 |
| 538 void DestroyClipboard() { | 538 void DestroyClipboard() { |
| 539 ui::Clipboard::DestroyClipboardForCurrentThread(); | 539 ui::Clipboard::DestroyClipboardForCurrentThread(); |
| 540 } | 540 } |
| 541 | 541 |
| 542 void SetClipboardText(const std::wstring& text) { | 542 void SetClipboardText(const std::wstring& text) { |
| 543 ui::ScopedClipboardWriter clipboard_writer( | 543 ui::ScopedClipboardWriter clipboard_writer( |
| 544 ui::Clipboard::GetForCurrentThread(), | 544 ui::Clipboard::GetForCurrentThread(), |
| 545 ui::CLIPBOARD_TYPE_COPY_PASTE); | 545 ui::CLIPBOARD_TYPE_COPY_PASTE); |
| 546 clipboard_writer.WriteText(WideToUTF16(text)); | 546 clipboard_writer.WriteText(base::WideToUTF16(text)); |
| 547 } | 547 } |
| 548 | 548 |
| 549 bool AddCFMetaTag(std::string* html_data) { | 549 bool AddCFMetaTag(std::string* html_data) { |
| 550 if (!html_data) { | 550 if (!html_data) { |
| 551 NOTREACHED(); | 551 NOTREACHED(); |
| 552 return false; | 552 return false; |
| 553 } | 553 } |
| 554 std::string lower = StringToLowerASCII(*html_data); | 554 std::string lower = StringToLowerASCII(*html_data); |
| 555 size_t head = lower.find("<head>"); | 555 size_t head = lower.find("<head>"); |
| 556 if (head == std::string::npos) { | 556 if (head == std::string::npos) { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 if (address.empty()) { | 737 if (address.empty()) { |
| 738 LOG(ERROR) << "Failed to find a non-loopback IP_V4 address. Tests will be " | 738 LOG(ERROR) << "Failed to find a non-loopback IP_V4 address. Tests will be " |
| 739 << "run over the loopback adapter, which may result in hangs."; | 739 << "run over the loopback adapter, which may result in hangs."; |
| 740 address.assign("127.0.0.1"); | 740 address.assign("127.0.0.1"); |
| 741 } | 741 } |
| 742 | 742 |
| 743 return address; | 743 return address; |
| 744 } | 744 } |
| 745 | 745 |
| 746 } // namespace chrome_frame_test | 746 } // namespace chrome_frame_test |
| OLD | NEW |