Index: chrome_frame/test/chrome_frame_test_utils.cc |
diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc |
index 5e77f93805783c2e19f3dd2ec18ef793a2c36f79..7e14bca49bb520fb4490db29ba68cc877e907c6c 100644 |
--- a/chrome_frame/test/chrome_frame_test_utils.cc |
+++ b/chrome_frame/test/chrome_frame_test_utils.cc |
@@ -30,6 +30,7 @@ |
#include "chrome/common/chrome_paths.h" |
#include "chrome/common/chrome_paths_internal.h" |
#include "chrome/common/chrome_switches.h" |
+#include "chrome/test/base/ui_test_utils.h" |
#include "chrome_frame/utils.h" |
#include "net/base/net_util.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -239,6 +240,29 @@ base::ProcessHandle LaunchIE(const std::wstring& url) { |
return LaunchExecutable(kIEImageName, url); |
} |
+bool TakeSnapshotAndLog() { |
+ testing::UnitTest* unit_test = testing::UnitTest::GetInstance(); |
+ const testing::TestInfo* test_info = unit_test->current_test_info(); |
+ std::string name; |
+ if (test_info != NULL) { |
+ name.append(test_info->test_case_name()) |
+ .append(1, '.') |
+ .append(test_info->name()); |
+ } else { |
+ name = "unknown test"; |
+ } |
+ |
+ base::FilePath snapshot; |
+ if (!ui_test_utils::SaveScreenSnapshotToDesktop(&snapshot)) { |
+ LOG(ERROR) << "Failed saving screen snapshot for " << name; |
+ return false; |
+ } |
+ |
+ LOG(ERROR) << "Saved screen snapshot for " << name << " to " |
+ << snapshot.value(); |
+ return true; |
+} |
+ |
int CloseAllIEWindows() { |
int ret = 0; |