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

Side by Side Diff: webkit/glue/bookmarklet_unittest.cc

Issue 150146: Add Reload and LoadData methods to WebFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/api/src/WebURLRequest.cpp ('k') | webkit/glue/cpp_bound_class_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "config.h" 5 #include "config.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 }; 25 };
26 26
27 TEST_F(BookmarkletTest, Redirect) { 27 TEST_F(BookmarkletTest, Redirect) {
28 test_shell_->LoadURL(L"javascript:location.href='data:text/plain,SUCCESS'"); 28 test_shell_->LoadURL(L"javascript:location.href='data:text/plain,SUCCESS'");
29 test_shell_->WaitTestFinished(); 29 test_shell_->WaitTestFinished();
30 std::wstring text = test_shell_->GetDocumentText(); 30 std::wstring text = test_shell_->GetDocumentText();
31 EXPECT_EQ(L"SUCCESS", text); 31 EXPECT_EQ(L"SUCCESS", text);
32 } 32 }
33 33
34 TEST_F(BookmarkletTest, RedirectVoided) {
35 // This test should be redundant with the Redirect test above. The point
36 // here is to emphasize that in either case the assignment to location during
37 // the evaluation of the script should suppress loading the script result.
38 // Here, because of the void() wrapping there is no script result.
39 test_shell_->LoadURL(L"javascript:void(location.href='data:text/plain,SUCCESS' )");
40 test_shell_->WaitTestFinished();
41 std::wstring text = test_shell_->GetDocumentText();
42 EXPECT_EQ(L"SUCCESS", text);
43 }
44
34 TEST_F(BookmarkletTest, NonEmptyResult) { 45 TEST_F(BookmarkletTest, NonEmptyResult) {
35 std::wstring text; 46 std::wstring text;
36 47
37 // TODO(darin): This test fails in a JSC build. WebCore+JSC does not really 48 // TODO(darin): This test fails in a JSC build. WebCore+JSC does not really
38 // need to support this usage until WebCore supports javascript: URLs that 49 // need to support this usage until WebCore supports javascript: URLs that
39 // generate content (https://bugs.webkit.org/show_bug.cgi?id=14959). It is 50 // generate content (https://bugs.webkit.org/show_bug.cgi?id=14959). It is
40 // important to note that Safari does not support bookmarklets, and this is 51 // important to note that Safari does not support bookmarklets, and this is
41 // really an edge case. Our behavior with V8 is consistent with FF and IE. 52 // really an edge case. Our behavior with V8 is consistent with FF and IE.
42 #if 0 53 #if 0
43 test_shell_->LoadURL(L"javascript:false"); 54 test_shell_->LoadURL(L"javascript:false");
(...skipping 12 matching lines...) Expand all
56 test_shell_->LoadURL( 67 test_shell_->LoadURL(
57 L"javascript:document.open();" 68 L"javascript:document.open();"
58 L"document.write('hello world');" 69 L"document.write('hello world');"
59 L"document.close()"); 70 L"document.close()");
60 MessageLoop::current()->RunAllPending(); 71 MessageLoop::current()->RunAllPending();
61 std::wstring text = test_shell_->GetDocumentText(); 72 std::wstring text = test_shell_->GetDocumentText();
62 EXPECT_EQ(L"hello world", text); 73 EXPECT_EQ(L"hello world", text);
63 } 74 }
64 75
65 } // namespace 76 } // namespace
OLDNEW
« no previous file with comments | « webkit/api/src/WebURLRequest.cpp ('k') | webkit/glue/cpp_bound_class_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698