Implement some functions in testing_automation_provider_aura.cc
BUG=99706
TEST=none
Review URL: http://codereview.chromium.org/8506034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110007 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/automation/testing_automation_provider_aura.cc b/chrome/browser/automation/testing_automation_provider_aura.cc
index 191dbbb..e246d58 100644
--- a/chrome/browser/automation/testing_automation_provider_aura.cc
+++ b/chrome/browser/automation/testing_automation_provider_aura.cc
@@ -5,47 +5,81 @@
#include "chrome/browser/automation/testing_automation_provider.h"
#include "base/logging.h"
+#include "chrome/browser/automation/automation_window_tracker.h"
+#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/window.h"
+#include "ui/base/ui_base_types.h"
void TestingAutomationProvider::ActivateWindow(int handle) {
- // TODO(beng):
- NOTIMPLEMENTED();
+ aura::Window* window = window_tracker_->GetResource(handle);
+ if (window) {
+ window->Activate();
+ }
}
void TestingAutomationProvider::IsWindowMaximized(int handle,
bool* is_maximized,
bool* success) {
- // TODO(beng):
- NOTIMPLEMENTED();
+ aura::Window* window = window_tracker_->GetResource(handle);
+ if (window) {
+ int show_state = window->GetIntProperty(aura::kShowStateKey);
+ *is_maximized = (show_state == ui::SHOW_STATE_MAXIMIZED);
+ *success = true;
+ } else {
+ *success = false;
+ }
}
void TestingAutomationProvider::TerminateSession(int handle, bool* success) {
- // TODO(beng):
+ // TODO(benrg): what should this do in aura? It's
+ // currently unimplemented in most other providers.
+ *success = false;
NOTIMPLEMENTED();
}
void TestingAutomationProvider::GetWindowBounds(int handle,
gfx::Rect* bounds,
bool* success) {
- // TODO(beng):
- NOTIMPLEMENTED();
+ const aura::Window* window = window_tracker_->GetResource(handle);
+ if (window) {
+ *bounds = window->bounds();
+ *success = true;
+ } else {
+ *success = false;
+ }
}
void TestingAutomationProvider::SetWindowBounds(int handle,
const gfx::Rect& bounds,
bool* success) {
- // TODO(beng):
- NOTIMPLEMENTED();
+ aura::Window* window = window_tracker_->GetResource(handle);
+ if (window) {
+ window->SetBounds(bounds);
+ *success = true;
+ } else {
+ *success = false;
+ }
}
void TestingAutomationProvider::SetWindowVisible(int handle,
bool visible,
bool* result) {
- // TODO(beng):
- NOTIMPLEMENTED();
+ aura::Window* window = window_tracker_->GetResource(handle);
+ if (window) {
+ if (visible) {
+ window->Show();
+ } else {
+ window->Hide();
+ }
+ *result = true;
+ } else {
+ *result = false;
+ }
}
void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) {
- // TODO(beng):
- NOTIMPLEMENTED();
+ const aura::Window* window = window_tracker_->GetResource(handle);
+ DCHECK(window);
+ *text = window->title();
}