| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/common/render_messages.h" | 5 #include "chrome/common/render_messages.h" |
| 6 #include "chrome/test/render_view_test.h" | 6 #include "chrome/test/render_view_test.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 TEST_F(RenderViewTest, OnLoadAlternateHTMLText) { | 9 TEST_F(RenderViewTest, OnLoadAlternateHTMLText) { |
| 10 // Test a new navigation. | 10 // Test a new navigation. |
| 11 GURL test_url("http://www.google.com/some_test_url"); | 11 GURL test_url("http://www.google.com/some_test_url"); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 " style.getPropertyValue('direction');"); | 269 " style.getPropertyValue('direction');"); |
| 270 | 270 |
| 271 // Copy the document content to std::wstring and compare with the | 271 // Copy the document content to std::wstring and compare with the |
| 272 // expected result. | 272 // expected result. |
| 273 const int kMaxOutputCharacters = 16; | 273 const int kMaxOutputCharacters = 16; |
| 274 std::wstring output; | 274 std::wstring output; |
| 275 GetMainFrame()->GetContentAsPlainText(kMaxOutputCharacters, &output); | 275 GetMainFrame()->GetContentAsPlainText(kMaxOutputCharacters, &output); |
| 276 EXPECT_EQ(output, kTextDirection[i].expected_result); | 276 EXPECT_EQ(output, kTextDirection[i].expected_result); |
| 277 } | 277 } |
| 278 } | 278 } |
| 279 |
| 280 // Tests that printing pages work and sending and receiving messages through |
| 281 // that channel all works. |
| 282 TEST_F(RenderViewTest, OnPrintPages) { |
| 283 #if defined(OS_WIN) |
| 284 // Lets simulate a print pages with Hello world. |
| 285 LoadHTML("<body><p>Hello World!</p></body>"); |
| 286 view_->OnPrintPages(); |
| 287 |
| 288 // The renderer should be done calculating the number of rendered pages |
| 289 // according to the specified settings defined in the mock render thread. |
| 290 // Verify the page count is correct. |
| 291 const IPC::Message* page_cnt_msg = |
| 292 render_thread_.sink().GetUniqueMessageMatching( |
| 293 ViewHostMsg_DidGetPrintedPagesCount::ID); |
| 294 EXPECT_TRUE(page_cnt_msg); |
| 295 ViewHostMsg_DidGetPrintedPagesCount::Param post_page_count_param; |
| 296 ViewHostMsg_DidGetPrintedPagesCount::Read(page_cnt_msg, |
| 297 &post_page_count_param); |
| 298 EXPECT_EQ(1, post_page_count_param.b); |
| 299 |
| 300 // Verify the rendered "printed page". |
| 301 const IPC::Message* did_print_msg = |
| 302 render_thread_.sink().GetUniqueMessageMatching( |
| 303 ViewHostMsg_DidPrintPage::ID); |
| 304 EXPECT_TRUE(did_print_msg); |
| 305 ViewHostMsg_DidPrintPage::Param post_did_print_page_param; |
| 306 ViewHostMsg_DidPrintPage::Read(did_print_msg, &post_did_print_page_param); |
| 307 EXPECT_EQ(0, post_did_print_page_param.page_number); |
| 308 #else |
| 309 NOTIMPLEMENTED(); |
| 310 #endif |
| 311 } |
| OLD | NEW |