| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/test/base/ui_test_utils.h" | 5 #include "chrome/test/base/ui_test_utils.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 #include "ui/gfx/size.h" | 61 #include "ui/gfx/size.h" |
| 62 | 62 |
| 63 #if defined(TOOLKIT_VIEWS) | 63 #if defined(TOOLKIT_VIEWS) |
| 64 #include "ui/views/focus/accelerator_handler.h" | 64 #include "ui/views/focus/accelerator_handler.h" |
| 65 #endif | 65 #endif |
| 66 | 66 |
| 67 #if defined(USE_AURA) | 67 #if defined(USE_AURA) |
| 68 #include "ui/aura/root_window.h" | 68 #include "ui/aura/root_window.h" |
| 69 #endif | 69 #endif |
| 70 | 70 |
| 71 using content::WebContents; |
| 72 |
| 71 static const int kDefaultWsPort = 8880; | 73 static const int kDefaultWsPort = 8880; |
| 72 | 74 |
| 73 namespace ui_test_utils { | 75 namespace ui_test_utils { |
| 74 | 76 |
| 75 namespace { | 77 namespace { |
| 76 | 78 |
| 77 class DOMOperationObserver : public content::NotificationObserver, | 79 class DOMOperationObserver : public content::NotificationObserver, |
| 78 public content::WebContentsObserver { | 80 public content::WebContentsObserver { |
| 79 public: | 81 public: |
| 80 explicit DOMOperationObserver(RenderViewHost* render_view_host) | 82 explicit DOMOperationObserver(RenderViewHost* render_view_host) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 118 |
| 117 class FindInPageNotificationObserver : public content::NotificationObserver { | 119 class FindInPageNotificationObserver : public content::NotificationObserver { |
| 118 public: | 120 public: |
| 119 explicit FindInPageNotificationObserver(TabContentsWrapper* parent_tab) | 121 explicit FindInPageNotificationObserver(TabContentsWrapper* parent_tab) |
| 120 : parent_tab_(parent_tab), | 122 : parent_tab_(parent_tab), |
| 121 active_match_ordinal_(-1), | 123 active_match_ordinal_(-1), |
| 122 number_of_matches_(0) { | 124 number_of_matches_(0) { |
| 123 current_find_request_id_ = | 125 current_find_request_id_ = |
| 124 parent_tab->find_tab_helper()->current_find_request_id(); | 126 parent_tab->find_tab_helper()->current_find_request_id(); |
| 125 registrar_.Add(this, chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, | 127 registrar_.Add(this, chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, |
| 126 content::Source<TabContents>(parent_tab_->tab_contents())); | 128 content::Source<WebContents>(parent_tab_->tab_contents())); |
| 127 ui_test_utils::RunMessageLoop(); | 129 ui_test_utils::RunMessageLoop(); |
| 128 } | 130 } |
| 129 | 131 |
| 130 int active_match_ordinal() const { return active_match_ordinal_; } | 132 int active_match_ordinal() const { return active_match_ordinal_; } |
| 131 | 133 |
| 132 int number_of_matches() const { return number_of_matches_; } | 134 int number_of_matches() const { return number_of_matches_; } |
| 133 | 135 |
| 134 virtual void Observe(int type, const content::NotificationSource& source, | 136 virtual void Observe(int type, const content::NotificationSource& source, |
| 135 const content::NotificationDetails& details) { | 137 const content::NotificationDetails& details) { |
| 136 if (type == chrome::NOTIFICATION_FIND_RESULT_AVAILABLE) { | 138 if (type == chrome::NOTIFICATION_FIND_RESULT_AVAILABLE) { |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); | 1074 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); |
| 1073 } | 1075 } |
| 1074 | 1076 |
| 1075 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { | 1077 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { |
| 1076 DCHECK(bitmap); | 1078 DCHECK(bitmap); |
| 1077 SnapshotTaker taker; | 1079 SnapshotTaker taker; |
| 1078 return taker.TakeEntirePageSnapshot(rvh, bitmap); | 1080 return taker.TakeEntirePageSnapshot(rvh, bitmap); |
| 1079 } | 1081 } |
| 1080 | 1082 |
| 1081 } // namespace ui_test_utils | 1083 } // namespace ui_test_utils |
| OLD | NEW |