Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Side by Side Diff: chrome/browser/automation/testing_automation_provider_aura.cc

Issue 8506034: Implement some functions in testing_automation_provider_aura.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fit nit and fix build (oops) Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/browser/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/automation/automation_window_tracker.h"
9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/window.h"
11 #include "ui/base/ui_base_types.h"
8 12
9 void TestingAutomationProvider::ActivateWindow(int handle) { 13 void TestingAutomationProvider::ActivateWindow(int handle) {
10 // TODO(beng): 14 aura::Window* window = window_tracker_->GetResource(handle);
11 NOTIMPLEMENTED(); 15 if (window) {
16 window->Activate();
17 }
12 } 18 }
13 19
14 void TestingAutomationProvider::IsWindowMaximized(int handle, 20 void TestingAutomationProvider::IsWindowMaximized(int handle,
15 bool* is_maximized, 21 bool* is_maximized,
16 bool* success) { 22 bool* success) {
17 // TODO(beng): 23 aura::Window* window = window_tracker_->GetResource(handle);
18 NOTIMPLEMENTED(); 24 if (window) {
25 int show_state = window->GetIntProperty(aura::kShowStateKey);
26 *is_maximized = (show_state == ui::SHOW_STATE_MAXIMIZED);
27 *success = true;
28 } else {
29 *success = false;
30 }
19 } 31 }
20 32
21 void TestingAutomationProvider::TerminateSession(int handle, bool* success) { 33 void TestingAutomationProvider::TerminateSession(int handle, bool* success) {
22 // TODO(beng): 34 // TODO(benrg): what should this do in aura? It's
35 // currently unimplemented in most other providers.
36 *success = false;
23 NOTIMPLEMENTED(); 37 NOTIMPLEMENTED();
24 } 38 }
25 39
26 void TestingAutomationProvider::GetWindowBounds(int handle, 40 void TestingAutomationProvider::GetWindowBounds(int handle,
27 gfx::Rect* bounds, 41 gfx::Rect* bounds,
28 bool* success) { 42 bool* success) {
29 // TODO(beng): 43 const aura::Window* window = window_tracker_->GetResource(handle);
30 NOTIMPLEMENTED(); 44 if (window) {
45 *bounds = window->bounds();
46 *success = true;
47 } else {
48 *success = false;
49 }
31 } 50 }
32 51
33 void TestingAutomationProvider::SetWindowBounds(int handle, 52 void TestingAutomationProvider::SetWindowBounds(int handle,
34 const gfx::Rect& bounds, 53 const gfx::Rect& bounds,
35 bool* success) { 54 bool* success) {
36 // TODO(beng): 55 aura::Window* window = window_tracker_->GetResource(handle);
37 NOTIMPLEMENTED(); 56 if (window) {
57 window->SetBounds(bounds);
58 *success = true;
59 } else {
60 *success = false;
61 }
38 } 62 }
39 63
40 void TestingAutomationProvider::SetWindowVisible(int handle, 64 void TestingAutomationProvider::SetWindowVisible(int handle,
41 bool visible, 65 bool visible,
42 bool* result) { 66 bool* result) {
43 // TODO(beng): 67 aura::Window* window = window_tracker_->GetResource(handle);
44 NOTIMPLEMENTED(); 68 if (window) {
69 if (visible) {
70 window->Show();
71 } else {
72 window->Hide();
73 }
74 *result = true;
75 } else {
76 *result = false;
77 }
45 } 78 }
46 79
47 void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) { 80 void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) {
48 // TODO(beng): 81 const aura::Window* window = window_tracker_->GetResource(handle);
49 NOTIMPLEMENTED(); 82 DCHECK(window);
83 *text = window->title();
50 } 84 }
51 85
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698