OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 | 6 |
7 #include "base/memory/shared_memory.h" | 7 #include "base/memory/shared_memory.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1951 SSLStatus ssl_status = view()->GetSSLStatusOfFrame(frame); | 1951 SSLStatus ssl_status = view()->GetSSLStatusOfFrame(frame); |
1952 EXPECT_FALSE(net::IsCertStatusError(ssl_status.cert_status)); | 1952 EXPECT_FALSE(net::IsCertStatusError(ssl_status.cert_status)); |
1953 | 1953 |
1954 const_cast<WebKit::WebURLResponse&>(frame->dataSource()->response()). | 1954 const_cast<WebKit::WebURLResponse&>(frame->dataSource()->response()). |
1955 setSecurityInfo( | 1955 setSecurityInfo( |
1956 SerializeSecurityInfo(0, net::CERT_STATUS_ALL_ERRORS, 0, 0)); | 1956 SerializeSecurityInfo(0, net::CERT_STATUS_ALL_ERRORS, 0, 0)); |
1957 ssl_status = view()->GetSSLStatusOfFrame(frame); | 1957 ssl_status = view()->GetSSLStatusOfFrame(frame); |
1958 EXPECT_TRUE(net::IsCertStatusError(ssl_status.cert_status)); | 1958 EXPECT_TRUE(net::IsCertStatusError(ssl_status.cert_status)); |
1959 } | 1959 } |
1960 | 1960 |
| 1961 TEST_F(RenderViewImplTest, MessageOrderInDidChangeSelection) { |
| 1962 view()->OnSetInputMethodActive(true); |
| 1963 view()->set_send_content_state_immediately(true); |
| 1964 LoadHTML("<textarea id=\"test\"></textarea>"); |
| 1965 |
| 1966 view()->handling_input_event_ = true; |
| 1967 ExecuteJavaScript("document.getElementById('test').focus();"); |
| 1968 |
| 1969 bool is_input_type_called = false; |
| 1970 bool is_selection_called = false; |
| 1971 size_t last_input_type = 0; |
| 1972 size_t last_selection = 0; |
| 1973 |
| 1974 for (size_t i = 0; i < render_thread_->sink().message_count(); ++i) { |
| 1975 const uint32 type = render_thread_->sink().GetMessageAt(i)->type(); |
| 1976 if (type == ViewHostMsg_TextInputTypeChanged::ID) { |
| 1977 is_input_type_called = true; |
| 1978 last_input_type = i; |
| 1979 } else if (type == ViewHostMsg_SelectionChanged::ID) { |
| 1980 is_selection_called = true; |
| 1981 last_selection = i; |
| 1982 } |
| 1983 } |
| 1984 |
| 1985 EXPECT_TRUE(is_input_type_called); |
| 1986 EXPECT_TRUE(is_selection_called); |
| 1987 |
| 1988 // InputTypeChange shold be called earlier than SelectionChanged. |
| 1989 EXPECT_LT(last_input_type, last_selection); |
| 1990 } |
| 1991 |
1961 class SuppressErrorPageTest : public RenderViewTest { | 1992 class SuppressErrorPageTest : public RenderViewTest { |
1962 public: | 1993 public: |
1963 virtual void SetUp() OVERRIDE { | 1994 virtual void SetUp() OVERRIDE { |
1964 SetRendererClientForTesting(&client_); | 1995 SetRendererClientForTesting(&client_); |
1965 RenderViewTest::SetUp(); | 1996 RenderViewTest::SetUp(); |
1966 } | 1997 } |
1967 | 1998 |
1968 RenderViewImpl* view() { | 1999 RenderViewImpl* view() { |
1969 return static_cast<RenderViewImpl*>(view_); | 2000 return static_cast<RenderViewImpl*>(view_); |
1970 } | 2001 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2043 | 2074 |
2044 // An error occurred. | 2075 // An error occurred. |
2045 view()->didFailProvisionalLoad(web_frame, error); | 2076 view()->didFailProvisionalLoad(web_frame, error); |
2046 ProcessPendingMessages(); | 2077 ProcessPendingMessages(); |
2047 const int kMaxOutputCharacters = 22; | 2078 const int kMaxOutputCharacters = 22; |
2048 EXPECT_EQ("A suffusion of yellow.", | 2079 EXPECT_EQ("A suffusion of yellow.", |
2049 UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); | 2080 UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); |
2050 } | 2081 } |
2051 | 2082 |
2052 } // namespace content | 2083 } // namespace content |
OLD | NEW |