OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 277 |
278 TEST_F(WebViewTest, SetBaseBackgroundColorBeforeMainFrame) | 278 TEST_F(WebViewTest, SetBaseBackgroundColorBeforeMainFrame) |
279 { | 279 { |
280 const WebColor kBlue = 0xFF0000FF; | 280 const WebColor kBlue = 0xFF0000FF; |
281 FrameTestHelpers::TestWebViewClient webViewClient; | 281 FrameTestHelpers::TestWebViewClient webViewClient; |
282 WebView* webView = WebViewImpl::create(&webViewClient); | 282 WebView* webView = WebViewImpl::create(&webViewClient); |
283 EXPECT_NE(kBlue, webView->backgroundColor()); | 283 EXPECT_NE(kBlue, webView->backgroundColor()); |
284 // webView does not have a frame yet, but we should still be able to set the
background color. | 284 // webView does not have a frame yet, but we should still be able to set the
background color. |
285 webView->setBaseBackgroundColor(kBlue); | 285 webView->setBaseBackgroundColor(kBlue); |
286 EXPECT_EQ(kBlue, webView->backgroundColor()); | 286 EXPECT_EQ(kBlue, webView->backgroundColor()); |
287 webView->setMainFrame(WebLocalFrameImpl::create(0)); | 287 WebLocalFrameImpl* frame = WebLocalFrameImpl::create(0); |
| 288 webView->setMainFrame(frame); |
288 webView->close(); | 289 webView->close(); |
| 290 frame->close(); |
289 } | 291 } |
290 | 292 |
291 TEST_F(WebViewTest, SetBaseBackgroundColorAndBlendWithExistingContent) | 293 TEST_F(WebViewTest, SetBaseBackgroundColorAndBlendWithExistingContent) |
292 { | 294 { |
293 const WebColor kAlphaRed = 0x80FF0000; | 295 const WebColor kAlphaRed = 0x80FF0000; |
294 const WebColor kAlphaGreen = 0x8000FF00; | 296 const WebColor kAlphaGreen = 0x8000FF00; |
295 const int kWidth = 100; | 297 const int kWidth = 100; |
296 const int kHeight = 100; | 298 const int kHeight = 100; |
297 | 299 |
298 WebView* webView = m_webViewHelper.initialize(); | 300 WebView* webView = m_webViewHelper.initialize(); |
(...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2162 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); | 2164 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
2163 frame->executeScript(WebScriptSource(WebString::fromUTF8("document.execComma
nd('SelectAll', false, null)"))); | 2165 frame->executeScript(WebScriptSource(WebString::fromUTF8("document.execComma
nd('SelectAll', false, null)"))); |
2164 std::string actual = frame->selectionAsText().utf8(); | 2166 std::string actual = frame->selectionAsText().utf8(); |
2165 | 2167 |
2166 const int kMaxOutputCharacters = 1024; | 2168 const int kMaxOutputCharacters = 1024; |
2167 std::string expected = frame->contentAsText(kMaxOutputCharacters).utf8(); | 2169 std::string expected = frame->contentAsText(kMaxOutputCharacters).utf8(); |
2168 EXPECT_EQ(expected, actual); | 2170 EXPECT_EQ(expected, actual); |
2169 } | 2171 } |
2170 | 2172 |
2171 } // namespace | 2173 } // namespace |
OLD | NEW |