| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #include "testing/gtest/include/gtest/gtest.h" | 57 #include "testing/gtest/include/gtest/gtest.h" |
| 58 #include "third_party/skia/include/core/SkBitmap.h" | 58 #include "third_party/skia/include/core/SkBitmap.h" |
| 59 #include "third_party/skia/include/core/SkColor.h" | 59 #include "third_party/skia/include/core/SkColor.h" |
| 60 #include "ui/gfx/size.h" | 60 #include "ui/gfx/size.h" |
| 61 | 61 |
| 62 #if defined(TOOLKIT_VIEWS) | 62 #if defined(TOOLKIT_VIEWS) |
| 63 #include "ui/views/focus/accelerator_handler.h" | 63 #include "ui/views/focus/accelerator_handler.h" |
| 64 #endif | 64 #endif |
| 65 | 65 |
| 66 #if defined(USE_AURA) | 66 #if defined(USE_AURA) |
| 67 #include "ui/aura/desktop.h" | 67 #include "ui/aura/root_window.h" |
| 68 #endif | 68 #endif |
| 69 | 69 |
| 70 static const int kDefaultWsPort = 8880; | 70 static const int kDefaultWsPort = 8880; |
| 71 | 71 |
| 72 namespace ui_test_utils { | 72 namespace ui_test_utils { |
| 73 | 73 |
| 74 namespace { | 74 namespace { |
| 75 | 75 |
| 76 class DOMOperationObserver : public content::NotificationObserver { | 76 class DOMOperationObserver : public content::NotificationObserver { |
| 77 public: | 77 public: |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 void RunMessageLoop() { | 247 void RunMessageLoop() { |
| 248 MessageLoop* loop = MessageLoop::current(); | 248 MessageLoop* loop = MessageLoop::current(); |
| 249 MessageLoopForUI* ui_loop = | 249 MessageLoopForUI* ui_loop = |
| 250 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI) ? | 250 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI) ? |
| 251 MessageLoopForUI::current() : NULL; | 251 MessageLoopForUI::current() : NULL; |
| 252 bool did_allow_task_nesting = loop->NestableTasksAllowed(); | 252 bool did_allow_task_nesting = loop->NestableTasksAllowed(); |
| 253 loop->SetNestableTasksAllowed(true); | 253 loop->SetNestableTasksAllowed(true); |
| 254 if (ui_loop) { | 254 if (ui_loop) { |
| 255 #if defined(USE_AURA) | 255 #if defined(USE_AURA) |
| 256 aura::Desktop::GetInstance()->Run(); | 256 aura::RootWindow::GetInstance()->Run(); |
| 257 #elif defined(TOOLKIT_VIEWS) | 257 #elif defined(TOOLKIT_VIEWS) |
| 258 views::AcceleratorHandler handler; | 258 views::AcceleratorHandler handler; |
| 259 ui_loop->RunWithDispatcher(&handler); | 259 ui_loop->RunWithDispatcher(&handler); |
| 260 #elif defined(OS_POSIX) && !defined(OS_MACOSX) | 260 #elif defined(OS_POSIX) && !defined(OS_MACOSX) |
| 261 ui_loop->RunWithDispatcher(NULL); | 261 ui_loop->RunWithDispatcher(NULL); |
| 262 #else | 262 #else |
| 263 ui_loop->Run(); | 263 ui_loop->Run(); |
| 264 #endif | 264 #endif |
| 265 } else { | 265 } else { |
| 266 loop->Run(); | 266 loop->Run(); |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); | 1053 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { | 1056 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { |
| 1057 DCHECK(bitmap); | 1057 DCHECK(bitmap); |
| 1058 SnapshotTaker taker; | 1058 SnapshotTaker taker; |
| 1059 return taker.TakeEntirePageSnapshot(rvh, bitmap); | 1059 return taker.TakeEntirePageSnapshot(rvh, bitmap); |
| 1060 } | 1060 } |
| 1061 | 1061 |
| 1062 } // namespace ui_test_utils | 1062 } // namespace ui_test_utils |
| OLD | NEW |