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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/md5.h" | 8 #include "base/md5.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 TEST_F(AutomationRendererHelperTest, ScrollingSnapshot) { | 59 TEST_F(AutomationRendererHelperTest, ScrollingSnapshot) { |
60 GetWebWidget()->resize(WebKit::WebSize(40, 90)); | 60 GetWebWidget()->resize(WebKit::WebSize(40, 90)); |
61 LoadHTML(kThreeBoxesHTML); | 61 LoadHTML(kThreeBoxesHTML); |
62 std::vector<unsigned char> png_data; | 62 std::vector<unsigned char> png_data; |
63 std::string error_msg; | 63 std::string error_msg; |
64 ASSERT_TRUE(AutomationRendererHelper(view_).SnapshotEntirePage( | 64 ASSERT_TRUE(AutomationRendererHelper(view_).SnapshotEntirePage( |
65 view_->GetWebView(), &png_data, &error_msg)) << error_msg; | 65 view_->GetWebView(), &png_data, &error_msg)) << error_msg; |
66 CompareSnapshot(png_data, kThreeBoxesMD5); | 66 CompareSnapshot(png_data, kThreeBoxesMD5); |
67 } | 67 } |
68 | 68 |
69 TEST_F(AutomationRendererHelperTest, DISABLED_RTLSnapshot) { | 69 TEST_F(AutomationRendererHelperTest, RTLSnapshot) { |
70 GetWebWidget()->resize(WebKit::WebSize(40, 90)); | 70 GetWebWidget()->resize(WebKit::WebSize(40, 90)); |
71 const char kThreeBoxesRTLHTML[] = | 71 const char kThreeBoxesRTLHTML[] = |
72 "<style> * { margin:0px; padding:0px } </style>" | 72 "<style> * { margin:0px; padding:0px } </style>" |
73 "<body dir='rtl'>" | 73 "<body dir='rtl'>" |
74 " <div style='background:red;width:100;height:100'></div>" | 74 " <div style='background:red;width:100;height:100'></div>" |
75 " <div style='background:green;width:100;height:100'></div>" | 75 " <div style='background:green;width:100;height:100'></div>" |
76 " <div style='background:blue;width:100;height:100'></div>" | 76 " <div style='background:blue;width:100;height:100'></div>" |
77 "</body>"; | 77 "</body>"; |
78 LoadHTML(kThreeBoxesRTLHTML); | 78 LoadHTML(kThreeBoxesRTLHTML); |
79 std::vector<unsigned char> png_data; | 79 std::vector<unsigned char> png_data; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 scoped_ptr<base::DictionaryValue> result; | 115 scoped_ptr<base::DictionaryValue> result; |
116 std::string error; | 116 std::string error; |
117 ASSERT_FALSE(helper.EvaluateScriptChain(script_chain, &result, &error)); | 117 ASSERT_FALSE(helper.EvaluateScriptChain(script_chain, &result, &error)); |
118 scoped_ptr<base::Value> value(base::JSONReader::Read(error)); | 118 scoped_ptr<base::Value> value(base::JSONReader::Read(error)); |
119 base::DictionaryValue* dict; | 119 base::DictionaryValue* dict; |
120 ASSERT_TRUE(value->GetAsDictionary(&dict)); | 120 ASSERT_TRUE(value->GetAsDictionary(&dict)); |
121 std::string msg; | 121 std::string msg; |
122 ASSERT_TRUE(dict->GetString("msg", &msg)); | 122 ASSERT_TRUE(dict->GetString("msg", &msg)); |
123 EXPECT_STREQ("some msg", msg.c_str()); | 123 EXPECT_STREQ("some msg", msg.c_str()); |
124 } | 124 } |
OLD | NEW |