| OLD | NEW |
| 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 "base/string_util.h" | 5 #include "base/string_util.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 #include "webkit/api/public/WebData.h" | 7 #include "webkit/api/public/WebData.h" |
| 8 #include "webkit/api/public/WebFrame.h" | 8 #include "webkit/api/public/WebFrame.h" |
| 9 #include "webkit/api/public/WebString.h" | 9 #include "webkit/api/public/WebString.h" |
| 10 #include "webkit/api/public/WebURL.h" | 10 #include "webkit/api/public/WebURL.h" |
| 11 #include "webkit/glue/webview.h" | 11 #include "webkit/api/public/WebView.h" |
| 12 #include "webkit/tools/test_shell/test_shell_test.h" | 12 #include "webkit/tools/test_shell/test_shell_test.h" |
| 13 | 13 |
| 14 using WebKit::WebFrame; | 14 using WebKit::WebFrame; |
| 15 using WebKit::WebString; | 15 using WebKit::WebString; |
| 16 using WebKit::WebView; |
| 16 | 17 |
| 17 class WebFrameTest : public TestShellTest { | 18 class WebFrameTest : public TestShellTest { |
| 18 public: | |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 TEST_F(WebFrameTest, GetContentAsPlainText) { | 21 TEST_F(WebFrameTest, GetContentAsPlainText) { |
| 22 WebView* view = test_shell_->webView(); | 22 WebView* view = test_shell_->webView(); |
| 23 WebFrame* frame = view->mainFrame(); | 23 WebFrame* frame = view->mainFrame(); |
| 24 | 24 |
| 25 // Generate a simple test case. | 25 // Generate a simple test case. |
| 26 const char simple_source[] = "<div>Foo bar</div><div></div>baz"; | 26 const char simple_source[] = "<div>Foo bar</div><div></div>baz"; |
| 27 GURL test_url("http://foo/"); | 27 GURL test_url("http://foo/"); |
| 28 frame->loadHTMLString(simple_source, test_url); | 28 frame->loadHTMLString(simple_source, test_url); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 // Test selection check | 86 // Test selection check |
| 87 EXPECT_FALSE(frame->hasSelection()); | 87 EXPECT_FALSE(frame->hasSelection()); |
| 88 frame->executeCommand(WebString::fromUTF8("SelectAll")); | 88 frame->executeCommand(WebString::fromUTF8("SelectAll")); |
| 89 EXPECT_TRUE(frame->hasSelection()); | 89 EXPECT_TRUE(frame->hasSelection()); |
| 90 frame->executeCommand(WebString::fromUTF8("Unselect")); | 90 frame->executeCommand(WebString::fromUTF8("Unselect")); |
| 91 EXPECT_FALSE(frame->hasSelection()); | 91 EXPECT_FALSE(frame->hasSelection()); |
| 92 WebString selection_html = frame->selectionAsMarkup(); | 92 WebString selection_html = frame->selectionAsMarkup(); |
| 93 EXPECT_TRUE(selection_html.isEmpty()); | 93 EXPECT_TRUE(selection_html.isEmpty()); |
| 94 } | 94 } |
| OLD | NEW |