OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 7029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7040 | 7040 |
7041 // Access the initial document from a javascript: URL. | 7041 // Access the initial document from a javascript: URL. |
7042 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 7042 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), |
7043 "javascript:document.body.appendChild(document." | 7043 "javascript:document.body.appendChild(document." |
7044 "createTextNode('Modified'))"); | 7044 "createTextNode('Modified'))"); |
7045 EXPECT_EQ(1, web_frame_client.did_access_initial_document_); | 7045 EXPECT_EQ(1, web_frame_client.did_access_initial_document_); |
7046 | 7046 |
7047 web_view_helper.Reset(); | 7047 web_view_helper.Reset(); |
7048 } | 7048 } |
7049 | 7049 |
7050 TEST_P(ParameterizedWebFrameTest, DidAccessInitialDocumentBodyBeforeModalDialog) | 7050 TEST_P(ParameterizedWebFrameTest, |
7051 { | 7051 DidAccessInitialDocumentBodyBeforeModalDialog) { |
7052 TestAccessInitialDocumentWebFrameClient web_frame_client; | 7052 TestAccessInitialDocumentWebFrameClient web_frame_client; |
7053 FrameTestHelpers::WebViewHelper web_view_helper; | 7053 FrameTestHelpers::WebViewHelper web_view_helper; |
7054 web_view_helper.Initialize(true, &web_frame_client); | 7054 web_view_helper.Initialize(true, &web_frame_client); |
7055 RunPendingTasks(); | 7055 RunPendingTasks(); |
7056 EXPECT_EQ(0, web_frame_client.did_access_initial_document_); | 7056 EXPECT_EQ(0, web_frame_client.did_access_initial_document_); |
7057 | 7057 |
7058 // Create another window that will try to access it. | 7058 // Create another window that will try to access it. |
7059 FrameTestHelpers::WebViewHelper new_web_view_helper; | 7059 FrameTestHelpers::WebViewHelper new_web_view_helper; |
7060 WebViewBase* new_view = new_web_view_helper.InitializeWithOpener( | 7060 WebViewBase* new_view = new_web_view_helper.InitializeWithOpener( |
7061 web_view_helper.WebView()->MainFrame(), true); | 7061 web_view_helper.WebView()->MainFrame(), true); |
(...skipping 11 matching lines...) Expand all Loading... |
7073 WebScriptSource("window.opener.confirm('Modal');")); | 7073 WebScriptSource("window.opener.confirm('Modal');")); |
7074 EXPECT_EQ(3, web_frame_client.did_access_initial_document_); | 7074 EXPECT_EQ(3, web_frame_client.did_access_initial_document_); |
7075 | 7075 |
7076 // Ensure that we don't notify again later. | 7076 // Ensure that we don't notify again later. |
7077 RunPendingTasks(); | 7077 RunPendingTasks(); |
7078 EXPECT_EQ(3, web_frame_client.did_access_initial_document_); | 7078 EXPECT_EQ(3, web_frame_client.did_access_initial_document_); |
7079 | 7079 |
7080 web_view_helper.Reset(); | 7080 web_view_helper.Reset(); |
7081 } | 7081 } |
7082 | 7082 |
7083 TEST_P(ParameterizedWebFrameTest, DidWriteToInitialDocumentBeforeModalDialog) | 7083 TEST_P(ParameterizedWebFrameTest, DidWriteToInitialDocumentBeforeModalDialog) { |
7084 { | |
7085 TestAccessInitialDocumentWebFrameClient web_frame_client; | 7084 TestAccessInitialDocumentWebFrameClient web_frame_client; |
7086 FrameTestHelpers::WebViewHelper web_view_helper; | 7085 FrameTestHelpers::WebViewHelper web_view_helper; |
7087 web_view_helper.Initialize(true, &web_frame_client); | 7086 web_view_helper.Initialize(true, &web_frame_client); |
7088 RunPendingTasks(); | 7087 RunPendingTasks(); |
7089 EXPECT_EQ(0, web_frame_client.did_access_initial_document_); | 7088 EXPECT_EQ(0, web_frame_client.did_access_initial_document_); |
7090 | 7089 |
7091 // Create another window that will try to access it. | 7090 // Create another window that will try to access it. |
7092 FrameTestHelpers::WebViewHelper new_web_view_helper; | 7091 FrameTestHelpers::WebViewHelper new_web_view_helper; |
7093 WebViewBase* new_view = new_web_view_helper.InitializeWithOpener( | 7092 WebViewBase* new_view = new_web_view_helper.InitializeWithOpener( |
7094 web_view_helper.WebView()->MainFrame(), true); | 7093 web_view_helper.WebView()->MainFrame(), true); |
(...skipping 5146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12241 if (obj->IsText()) { | 12240 if (obj->IsText()) { |
12242 LayoutText* layout_text = ToLayoutText(obj); | 12241 LayoutText* layout_text = ToLayoutText(obj); |
12243 text = layout_text->GetText(); | 12242 text = layout_text->GetText(); |
12244 break; | 12243 break; |
12245 } | 12244 } |
12246 } | 12245 } |
12247 EXPECT_EQ("foo alt", text.Utf8()); | 12246 EXPECT_EQ("foo alt", text.Utf8()); |
12248 } | 12247 } |
12249 | 12248 |
12250 } // namespace blink | 12249 } // namespace blink |
OLD | NEW |