Chromium Code Reviews| Index: chrome/browser/extensions/api/app_window/app_window_apitest.cc |
| diff --git a/chrome/browser/extensions/api/app_window/app_window_apitest.cc b/chrome/browser/extensions/api/app_window/app_window_apitest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1c26e4f4686a41c35758f32ab8e9049e82a71360 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/app_window/app_window_apitest.cc |
| @@ -0,0 +1,38 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/string_number_conversions.h" |
| +#include "chrome/browser/extensions/extension_test_message_listener.h" |
| +#include "chrome/browser/extensions/platform_app_browsertest_util.h" |
| +#include "chrome/browser/ui/base_window.h" |
| +#include "chrome/browser/ui/extensions/shell_window.h" |
| +#include "ui/gfx/rect.h" |
| + |
| +namespace extensions { |
| + |
| +IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, WindowsApiBounds) { |
| + ExtensionTestMessageListener ready_listener("ready", true /* will_reply */); |
| + ExtensionTestMessageListener success_listener("success", false); |
| + |
| + LoadAndLaunchPlatformApp("windows_api_bounds"); |
| + ASSERT_TRUE(ready_listener.WaitUntilSatisfied()); |
| + ShellWindow* window = GetFirstShellWindow(); |
| + |
| + gfx::Rect new_bounds(100, 200, 300, 400); |
| + window->GetBaseWindow()->SetBounds(new_bounds); |
| + |
| + // Some windowing environments don't precisely match the requested |
| + // window bounds we set, so define a slop factor for the client to use in |
| + // judging success. |
| +#ifdef TOOLKIT_GTK |
| + int slop = 50; |
| +#else |
| + int slop = 10; |
|
jeremya
2012/11/02 05:06:41
What other platforms are these functions inaccurat
asargent_no_longer_on_chrome
2012/11/09 20:25:35
Done.
|
| +#endif // !TOOLKIT_GTK |
| + |
| + ready_listener.Reply(base::IntToString(slop)); |
| + ASSERT_TRUE(success_listener.WaitUntilSatisfied()); |
| +} |
| + |
| +} // namespace extensions |