OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 75 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); |
76 } | 76 } |
77 | 77 |
78 void registerMockedURLLoad(const std::string& url, const WebString& fileName
) | 78 void registerMockedURLLoad(const std::string& url, const WebString& fileName
) |
79 { | 79 { |
80 URLTestHelpers::registerMockedURLLoad(toKURL(url), fileName, WebString::
fromUTF8("mhtml/"), WebString::fromUTF8("text/html")); | 80 URLTestHelpers::registerMockedURLLoad(toKURL(url), fileName, WebString::
fromUTF8("mhtml/"), WebString::fromUTF8("text/html")); |
81 } | 81 } |
82 | 82 |
83 void loadURLInTopFrame(const WebURL& url) | 83 void loadURLInTopFrame(const WebURL& url) |
84 { | 84 { |
85 WebURLRequest urlRequest; | 85 FrameTestHelpers::loadFrame(m_helper.webView()->mainFrame(), url.string(
).utf8().data()); |
86 urlRequest.initialize(); | |
87 urlRequest.setURL(url); | |
88 m_helper.webView()->mainFrame()->loadRequest(urlRequest); | |
89 // Make sure any pending request get served. | |
90 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(
); | |
91 } | 86 } |
92 | 87 |
93 Page* page() const { return m_helper.webViewImpl()->page(); } | 88 Page* page() const { return m_helper.webViewImpl()->page(); } |
94 | 89 |
95 private: | 90 private: |
96 FrameTestHelpers::WebViewHelper m_helper; | 91 FrameTestHelpers::WebViewHelper m_helper; |
97 }; | 92 }; |
98 | 93 |
99 // Checks that the domain is set to the actual MHTML file, not the URL it was | 94 // Checks that the domain is set to the actual MHTML file, not the URL it was |
100 // generated from. | 95 // generated from. |
(...skipping 11 matching lines...) Expand all Loading... |
112 Document* document = frame->document(); | 107 Document* document = frame->document(); |
113 ASSERT_TRUE(document); | 108 ASSERT_TRUE(document); |
114 | 109 |
115 EXPECT_STREQ(kFileURL, frame->domWindow()->location().href().ascii().data())
; | 110 EXPECT_STREQ(kFileURL, frame->domWindow()->location().href().ascii().data())
; |
116 | 111 |
117 WebCore::SecurityOrigin* origin = document->securityOrigin(); | 112 WebCore::SecurityOrigin* origin = document->securityOrigin(); |
118 EXPECT_STRNE("localhost", origin->domain().ascii().data()); | 113 EXPECT_STRNE("localhost", origin->domain().ascii().data()); |
119 } | 114 } |
120 | 115 |
121 } | 116 } |
OLD | NEW |