OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/extension_tabs_module.h" | 5 #include "chrome/browser/extensions/extension_tabs_module.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 // Invalid window ID error. | 37 // Invalid window ID error. |
38 EXPECT_TRUE(MatchPattern( | 38 EXPECT_TRUE(MatchPattern( |
39 RunFunctionAndReturnError( | 39 RunFunctionAndReturnError( |
40 new GetWindowFunction(), | 40 new GetWindowFunction(), |
41 base::StringPrintf("[%u]", window_id + 1), | 41 base::StringPrintf("[%u]", window_id + 1), |
42 browser()), | 42 browser()), |
43 keys::kWindowNotFoundError)); | 43 keys::kWindowNotFoundError)); |
44 | 44 |
45 // Basic window details. | 45 // Basic window details. |
46 // Need GetRestoredBound instead of GetBounds. | 46 gfx::Rect bounds; |
47 // See crbug.com/98759. | 47 if (browser()->window()->IsMinimized()) |
48 gfx::Rect bounds = browser()->window()->GetRestoredBounds(); | 48 bounds = browser()->window()->GetRestoredBounds(); |
| 49 else |
| 50 bounds = browser()->window()->GetBounds(); |
49 | 51 |
50 scoped_ptr<base::DictionaryValue> result(ToDictionary( | 52 scoped_ptr<base::DictionaryValue> result(ToDictionary( |
51 RunFunctionAndReturnResult( | 53 RunFunctionAndReturnResult( |
52 new GetWindowFunction(), | 54 new GetWindowFunction(), |
53 base::StringPrintf("[%u]", window_id), | 55 base::StringPrintf("[%u]", window_id), |
54 browser()))); | 56 browser()))); |
55 EXPECT_EQ(window_id, GetInteger(result.get(), "id")); | 57 EXPECT_EQ(window_id, GetInteger(result.get(), "id")); |
56 EXPECT_FALSE(GetBoolean(result.get(), "incognito")); | 58 EXPECT_FALSE(GetBoolean(result.get(), "incognito")); |
57 EXPECT_EQ("normal", GetString(result.get(), "type")); | 59 EXPECT_EQ("normal", GetString(result.get(), "type")); |
58 EXPECT_EQ(bounds.x(), GetInteger(result.get(), "left")); | 60 EXPECT_EQ(bounds.x(), GetInteger(result.get(), "left")); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 | 442 |
441 static const char kArgsMaximizedWithBounds[] = | 443 static const char kArgsMaximizedWithBounds[] = |
442 "[%u, {\"state\": \"maximized\", \"width\": 500}]"; | 444 "[%u, {\"state\": \"maximized\", \"width\": 500}]"; |
443 EXPECT_TRUE(MatchPattern( | 445 EXPECT_TRUE(MatchPattern( |
444 RunFunctionAndReturnError( | 446 RunFunctionAndReturnError( |
445 new UpdateWindowFunction(), | 447 new UpdateWindowFunction(), |
446 base::StringPrintf(kArgsMaximizedWithBounds, window_id), | 448 base::StringPrintf(kArgsMaximizedWithBounds, window_id), |
447 browser()), | 449 browser()), |
448 keys::kInvalidWindowStateError)); | 450 keys::kInvalidWindowStateError)); |
449 } | 451 } |
OLD | NEW |