Chromium Code Reviews| Index: chrome/test/automation/automation_proxy_uitest.cc |
| diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc |
| index e70a746395bf444e67665685d72bcdb9e86f1c0e..32608d173dce74407b44c1cae518245eccd5be0d 100644 |
| --- a/chrome/test/automation/automation_proxy_uitest.cc |
| +++ b/chrome/test/automation/automation_proxy_uitest.cc |
| @@ -1512,163 +1512,3 @@ TEST_F(AutomationProxyTest5, TestLifetimeOfDomAutomationController) { |
| ASSERT_TRUE(tab->ExecuteAndExtractString(L"", jscript, &actual)); |
| ASSERT_EQ(expected, actual); |
| } |
| - |
| -class AutomationProxySnapshotTest : public UITest { |
|
Paweł Hajdan Jr.
2011/10/18 10:21:35
The native testing environment for that code are U
kkania
2011/10/18 18:30:19
I was a bit too hasty to remove all these. I do th
|
| - protected: |
| - AutomationProxySnapshotTest() { |
| - dom_automation_enabled_ = true; |
| - if (!snapshot_dir_.CreateUniqueTempDir()) |
| - ADD_FAILURE() << "Unable to create temporary directory"; |
| - else |
| - snapshot_path_ = snapshot_dir_.path().AppendASCII("snapshot.png"); |
| - } |
| - |
| - // Asserts that the given png file can be read and decoded into the given |
| - // bitmap. |
| - void AssertReadPNG(const FilePath& filename, SkBitmap* bitmap) { |
| - DCHECK(bitmap); |
| - ASSERT_TRUE(file_util::PathExists(filename)); |
| - |
| - int64 size64; |
| - ASSERT_TRUE(file_util::GetFileSize(filename, &size64)); |
| - // Check that the file is not too big to read in (less than 100 MB). |
| - ASSERT_LT(size64, 1024 * 1024 * 100); |
| - |
| - // Read and decode image. |
| - int size = static_cast<int>(size64); |
| - scoped_array<char> data(new char[size]); |
| - int bytes_read = file_util::ReadFile(filename, &data[0], size); |
| - ASSERT_EQ(size, bytes_read); |
| - ASSERT_TRUE(gfx::PNGCodec::Decode( |
| - reinterpret_cast<unsigned char*>(&data[0]), |
| - bytes_read, |
| - bitmap)); |
| - } |
| - |
| - // Returns the file path for the directory for these tests appended with |
| - // the given relative path. |
| - FilePath GetTestFilePath(const std::string& relative_path) { |
| - FilePath filename(test_data_directory_); |
| - return filename.AppendASCII("automation_proxy_snapshot") |
| - .AppendASCII(relative_path); |
| - } |
| - |
| - GURL GetTestUrl(const std::string& relative_path, const std::string& query) { |
| - FilePath file_path = GetTestFilePath(relative_path); |
| - return ui_test_utils::GetFileUrlWithQuery(file_path, query); |
| - } |
| - |
| - FilePath snapshot_path_; |
| - ScopedTempDir snapshot_dir_; |
| -}; |
| - |
| -// See http://crbug.com/63022. |
| -#if defined(OS_LINUX) |
| -#define MAYBE_ContentLargerThanView FAILS_ContentLargerThanView |
| -#else |
| -#define MAYBE_ContentLargerThanView ContentLargerThanView |
| -#endif |
| -// Tests that taking a snapshot when the content is larger than the view |
| -// produces a snapshot equal to the content size. |
| -TEST_F(AutomationProxySnapshotTest, MAYBE_ContentLargerThanView) { |
| - scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| - ASSERT_TRUE(browser.get()); |
| - |
| - // Resize the window to guarantee that the content is larger than the view. |
| - scoped_refptr<WindowProxy> window(browser->GetWindow()); |
| - ASSERT_TRUE(window.get()); |
| - ASSERT_TRUE(window->SetBounds(gfx::Rect(300, 400))); |
| - |
| - scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
| - ASSERT_TRUE(tab.get()); |
| - |
| - ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, |
| - tab->NavigateToURL(GetTestUrl("set_size.html", "600,800"))); |
| - |
| - ASSERT_TRUE(tab->CaptureEntirePageAsPNG(snapshot_path_)); |
| - |
| - SkBitmap bitmap; |
| - ASSERT_NO_FATAL_FAILURE(AssertReadPNG(snapshot_path_, &bitmap)); |
| - ASSERT_EQ(600, bitmap.width()); |
| - ASSERT_EQ(800, bitmap.height()); |
| -} |
| - |
| -// Tests taking a large snapshot works. |
| -#if defined(OS_LINUX) |
| -// See http://code.google.com/p/chromium/issues/detail?id=89777 |
| -#define MAYBE_LargeSnapshot DISABLED_LargeSnapshot |
| -#else |
| -#define MAYBE_LargeSnapshot LargeSnapshot |
| -#endif |
| -TEST_F(AutomationProxySnapshotTest, MAYBE_LargeSnapshot) { |
| - scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| - ASSERT_TRUE(browser.get()); |
| - |
| - scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
| - ASSERT_TRUE(tab.get()); |
| - |
| - // 2000x2000 creates an approximately 15 MB bitmap. |
| - // Don't increase this too much. At least my linux box has SHMMAX set at |
| - // 32 MB. |
| - ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, |
| - tab->NavigateToURL(GetTestUrl("set_size.html", "2000,2000"))); |
| - |
| - ASSERT_TRUE(tab->CaptureEntirePageAsPNG(snapshot_path_)); |
| - |
| - SkBitmap bitmap; |
| - ASSERT_NO_FATAL_FAILURE(AssertReadPNG(snapshot_path_, &bitmap)); |
| - ASSERT_EQ(2000, bitmap.width()); |
| - ASSERT_EQ(2000, bitmap.height()); |
| -} |
| - |
| -#if defined(OS_MACOSX) |
| -// Most pixels on mac are slightly off. |
| -#define MAYBE_ContentsCorrect DISABLED_ContentsCorrect |
| -#elif defined(OS_LINUX) |
| -// See http://crbug.com/63022. |
| -#define MAYBE_ContentsCorrect FAILS_ContentsCorrect |
| -#else |
| -#define MAYBE_ContentsCorrect ContentsCorrect |
| -#endif |
| - |
| -// Tests that the snapshot contents are correct. |
| -TEST_F(AutomationProxySnapshotTest, MAYBE_ContentsCorrect) { |
| - scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| - ASSERT_TRUE(browser.get()); |
| - |
| - const gfx::Size img_size(400, 300); |
| - scoped_refptr<WindowProxy> window(browser->GetWindow()); |
| - ASSERT_TRUE(window.get()); |
| - ASSERT_TRUE(window->SetBounds(gfx::Rect(img_size))); |
| - |
| - scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
| - ASSERT_TRUE(tab.get()); |
| - |
| - ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, |
| - tab->NavigateToURL(GetTestUrl("just_image.html", ""))); |
| - |
| - ASSERT_TRUE(tab->CaptureEntirePageAsPNG(snapshot_path_)); |
| - |
| - SkBitmap snapshot_bmp; |
| - ASSERT_NO_FATAL_FAILURE(AssertReadPNG(snapshot_path_, &snapshot_bmp)); |
| - ASSERT_EQ(img_size.width(), snapshot_bmp.width()); |
| - ASSERT_EQ(img_size.height(), snapshot_bmp.height()); |
| - |
| - SkBitmap reference_bmp; |
| - ASSERT_NO_FATAL_FAILURE(AssertReadPNG(GetTestFilePath("image.png"), |
| - &reference_bmp)); |
| - ASSERT_EQ(img_size.width(), reference_bmp.width()); |
| - ASSERT_EQ(img_size.height(), reference_bmp.height()); |
| - |
| - SkAutoLockPixels lock_snapshot(snapshot_bmp); |
| - SkAutoLockPixels lock_reference(reference_bmp); |
| - int diff_pixels_count = 0; |
| - for (int x = 0; x < img_size.width(); ++x) { |
| - for (int y = 0; y < img_size.height(); ++y) { |
| - if (*snapshot_bmp.getAddr32(x, y) != *reference_bmp.getAddr32(x, y)) { |
| - ++diff_pixels_count; |
| - } |
| - } |
| - } |
| - ASSERT_EQ(diff_pixels_count, 0); |
| -} |