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

Unified Diff: chrome/browser/extensions/api/app_window/app_window_apitest.cc

Issue 11369039: Add setBounds method and browsertest for get/set bounds to app window API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698