Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Unified Diff: chrome_frame/test/chrome_frame_test_utils.cc

Issue 2822016: [chrome_frame] Refactor/merge IE no interference tests with other mock event ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome_frame/test/chrome_frame_test_utils.cc
===================================================================
--- chrome_frame/test/chrome_frame_test_utils.cc (revision 51119)
+++ chrome_frame/test/chrome_frame_test_utils.cc (working copy)
@@ -893,6 +893,56 @@
return profile_path;
}
+FilePath GetTestDataFolder() {
+ FilePath test_dir;
+ PathService::Get(base::DIR_SOURCE_ROOT, &test_dir);
+ test_dir = test_dir.Append(FILE_PATH_LITERAL("chrome_frame"))
+ .Append(FILE_PATH_LITERAL("test"))
+ .Append(FILE_PATH_LITERAL("data"));
+ return test_dir;
+}
+
+std::wstring GetPathFromUrl(const std::wstring& url) {
+ string16 url16 = WideToUTF16(url);
+ GURL gurl = GURL(url16);
+ if (gurl.has_query()) {
+ GURL::Replacements replacements;
+ replacements.ClearQuery();
+ gurl = gurl.ReplaceComponents(replacements);
+ }
+ return UTF8ToWide(gurl.PathForRequest());
+}
+
+std::wstring GetPathAndQueryFromUrl(const std::wstring& url) {
+ string16 url16 = WideToUTF16(url);
+ GURL gurl = GURL(url16);
+ return UTF8ToWide(gurl.PathForRequest());
+}
+
+bool AddCFMetaTag(std::string* html_data) {
+ if (!html_data) {
+ NOTREACHED();
+ return false;
+ }
+ size_t head = html_data->find("<head>");
+ if (head == std::string::npos) {
+ // Add missing head section.
+ size_t html = html_data->find("<html>");
+ EXPECT_NE(std::string::npos, html) << "Meta tag will not be injected "
+ << "because the html tag could not be found";
+ if (html != std::string::npos) {
+ html_data->insert(html + strlen("<html>"), "<head></head>");
+ head = html_data->find("<head>");
+ }
+ }
+ if (head != std::string::npos) {
+ html_data->insert(
+ head + strlen("<head>"),
+ "<meta http-equiv=\"x-ua-compatible\" content=\"chrome=1\" />");
+ }
+ return head != std::string::npos;
+}
+
void DelaySendExtendedKeysEnter(TimedMsgLoop* loop, int delay, char c,
int repeat, simulate_input::Modifier mod) {
const unsigned int kInterval = 25;

Powered by Google App Engine
This is Rietveld 408576698