| 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_tabstrip.h" | 14 #include "chrome/browser/ui/browser_tabstrip.h" |
| 15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
| 16 #include "chrome/test/base/ui_test_utils.h" | |
| 17 #include "content/browser/accessibility/browser_accessibility.h" | 16 #include "content/browser/accessibility/browser_accessibility.h" |
| 18 #include "content/browser/accessibility/browser_accessibility_manager.h" | 17 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 19 #include "content/browser/accessibility/dump_accessibility_tree_helper.h" | 18 #include "content/browser/accessibility/dump_accessibility_tree_helper.h" |
| 20 #include "content/browser/renderer_host/render_view_host_impl.h" | 19 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 21 #include "content/port/browser/render_widget_host_view_port.h" | 20 #include "content/port/browser/render_widget_host_view_port.h" |
| 22 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| 23 #include "content/public/browser/notification_types.h" | 22 #include "content/public/browser/notification_types.h" |
| 24 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 25 #include "content/public/common/content_paths.h" | 24 #include "content/public/common/content_paths.h" |
| 25 #include "content/public/test/test_utils.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 27 |
| 28 using content::OpenURLParams; | 28 using content::OpenURLParams; |
| 29 using content::RenderViewHostImpl; | 29 using content::RenderViewHostImpl; |
| 30 using content::RenderWidgetHostImpl; | 30 using content::RenderWidgetHostImpl; |
| 31 using content::RenderWidgetHost; | 31 using content::RenderWidgetHost; |
| 32 using content::RenderWidgetHostViewPort; | 32 using content::RenderWidgetHostViewPort; |
| 33 using content::Referrer; | 33 using content::Referrer; |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 RemoveChars(expected_contents_raw, "\r", &expected_contents); | 131 RemoveChars(expected_contents_raw, "\r", &expected_contents); |
| 132 | 132 |
| 133 if (!expected_contents.compare(0, strlen(kMarkSkipFile), kMarkSkipFile)) { | 133 if (!expected_contents.compare(0, strlen(kMarkSkipFile), kMarkSkipFile)) { |
| 134 printf("Skipping %s\n", html_file.BaseName().MaybeAsASCII().c_str()); | 134 printf("Skipping %s\n", html_file.BaseName().MaybeAsASCII().c_str()); |
| 135 continue; | 135 continue; |
| 136 } | 136 } |
| 137 | 137 |
| 138 printf("Testing %s\n", html_file.BaseName().MaybeAsASCII().c_str()); | 138 printf("Testing %s\n", html_file.BaseName().MaybeAsASCII().c_str()); |
| 139 | 139 |
| 140 // Load the page. | 140 // Load the page. |
| 141 ui_test_utils::WindowedNotificationObserver tree_updated_observer( | 141 content::WindowedNotificationObserver tree_updated_observer( |
| 142 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, | 142 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, |
| 143 content::NotificationService::AllSources()); | 143 content::NotificationService::AllSources()); |
| 144 string16 html_contents16; | 144 string16 html_contents16; |
| 145 html_contents16 = UTF8ToUTF16(html_contents); | 145 html_contents16 = UTF8ToUTF16(html_contents); |
| 146 GURL url(UTF8ToUTF16(kUrlPreamble) + html_contents16); | 146 GURL url(UTF8ToUTF16(kUrlPreamble) + html_contents16); |
| 147 browser()->OpenURL(OpenURLParams( | 147 browser()->OpenURL(OpenURLParams( |
| 148 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); | 148 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); |
| 149 | 149 |
| 150 // Wait for the tree. | 150 // Wait for the tree. |
| 151 tree_updated_observer.Wait(); | 151 tree_updated_observer.Wait(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 195 |
| 196 EXPECT_TRUE(file_util::WriteFile( | 196 EXPECT_TRUE(file_util::WriteFile( |
| 197 actual_file, actual_contents.c_str(), actual_contents.size())); | 197 actual_file, actual_contents.c_str(), actual_contents.size())); |
| 198 | 198 |
| 199 ADD_FAILURE() << "No expectation found. Create it by doing:\n" | 199 ADD_FAILURE() << "No expectation found. Create it by doing:\n" |
| 200 << "mv " << actual_file.LossyDisplayName() << " " | 200 << "mv " << actual_file.LossyDisplayName() << " " |
| 201 << expected_file.LossyDisplayName(); | 201 << expected_file.LossyDisplayName(); |
| 202 } | 202 } |
| 203 } while (!(html_file = file_enumerator.Next()).empty()); | 203 } while (!(html_file = file_enumerator.Next()).empty()); |
| 204 } | 204 } |
| OLD | NEW |