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

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: fix all comments 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/window.h"
8 10
9 void TestingAutomationProvider::ActivateWindow(int handle) { 11 void TestingAutomationProvider::ActivateWindow(int handle) {
10 // TODO(beng): 12 if (aura::Window* window = window_tracker_->GetResource(handle)) {
11 NOTIMPLEMENTED(); 13 window->Activate();
14 } else {
15 // TODO(benrg): Is it correct to fail silently? The Windows provider does.
16 }
12 } 17 }
13 18
14 void TestingAutomationProvider::IsWindowMaximized(int handle, 19 void TestingAutomationProvider::IsWindowMaximized(int handle,
15 bool* is_maximized, 20 bool* is_maximized,
16 bool* success) { 21 bool* success) {
17 // TODO(beng): 22 if (aura::Window* window = window_tracker_->GetResource(handle)) {
sky 2011/11/14 21:25:10 nit: move assignment out of conditional (just like
benrg 2011/11/14 22:59:40 Done.
18 NOTIMPLEMENTED(); 23 int show_state = window->GetIntProperty(aura::kShowStateKey);
24 *is_maximized = (show_state == SHOW_STATE_MAXIMIZED);
25 *success = true;
26 } else {
27 *success = false;
28 }
19 } 29 }
20 30
21 void TestingAutomationProvider::TerminateSession(int handle, bool* success) { 31 void TestingAutomationProvider::TerminateSession(int handle, bool* success) {
22 // TODO(beng): 32 // TODO(benrg): what should this do in aura? It's
33 // currently unimplemented in most other providers.
34 *success = false;
23 NOTIMPLEMENTED(); 35 NOTIMPLEMENTED();
24 } 36 }
25 37
26 void TestingAutomationProvider::GetWindowBounds(int handle, 38 void TestingAutomationProvider::GetWindowBounds(int handle,
27 gfx::Rect* bounds, 39 gfx::Rect* bounds,
28 bool* success) { 40 bool* success) {
29 // TODO(beng): 41 if (const aura::Window* window = window_tracker_->GetResource(handle)) {
30 NOTIMPLEMENTED(); 42 *bounds = window->bounds();
43 *success = true;
44 } else {
45 *success = false;
46 }
31 } 47 }
32 48
33 void TestingAutomationProvider::SetWindowBounds(int handle, 49 void TestingAutomationProvider::SetWindowBounds(int handle,
34 const gfx::Rect& bounds, 50 const gfx::Rect& bounds,
35 bool* success) { 51 bool* success) {
36 // TODO(beng): 52 if (aura::Window* window = window_tracker_->GetResource(handle)) {
37 NOTIMPLEMENTED(); 53 window->SetBounds(bounds);
54 *success = true;
55 } else {
56 *success = false;
57 }
38 } 58 }
39 59
40 void TestingAutomationProvider::SetWindowVisible(int handle, 60 void TestingAutomationProvider::SetWindowVisible(int handle,
41 bool visible, 61 bool visible,
42 bool* result) { 62 bool* result) {
43 // TODO(beng): 63 if (aura::Window* window = window_tracker_->GetResource(handle)) {
44 NOTIMPLEMENTED(); 64 if (visible) {
65 window->Show();
66 } else {
67 window->Hide();
68 }
69 *result = true;
70 } else {
71 *result = false;
72 }
45 } 73 }
46 74
47 void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) { 75 void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) {
48 // TODO(beng): 76 const aura::Window* window = window_tracker_->GetResource(handle);
49 NOTIMPLEMENTED(); 77 DCHECK(window);
78 *text = window->title();
50 } 79 }
51 80
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