OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/browser/shell_native_app_window_aura.h" | 5 #include "extensions/shell/browser/shell_native_app_window_aura.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "content/public/browser/browser_context.h" | 8 #include "content/public/browser/browser_context.h" |
9 #include "content/public/browser/notification_service.h" | 9 #include "content/public/browser/notification_service.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 ShellAppWindowClient app_window_client_; | 37 ShellAppWindowClient app_window_client_; |
38 }; | 38 }; |
39 | 39 |
40 TEST_F(ShellNativeAppWindowAuraTest, Bounds) { | 40 TEST_F(ShellNativeAppWindowAuraTest, Bounds) { |
41 // The BrowserContext used here must be destroyed before the thread bundle, | 41 // The BrowserContext used here must be destroyed before the thread bundle, |
42 // because of destructors of things spawned from creating a WebContents. | 42 // because of destructors of things spawned from creating a WebContents. |
43 scoped_ptr<content::BrowserContext> browser_context( | 43 scoped_ptr<content::BrowserContext> browser_context( |
44 new content::TestBrowserContext); | 44 new content::TestBrowserContext); |
45 scoped_refptr<Extension> extension = | 45 scoped_refptr<Extension> extension = |
46 ExtensionBuilder() | 46 ExtensionBuilder() |
47 .SetManifest(std::move(DictionaryBuilder() | 47 .SetManifest(DictionaryBuilder() |
48 .Set("name", "test extension") | 48 .Set("name", "test extension") |
49 .Set("version", "1") | 49 .Set("version", "1") |
50 .Set("manifest_version", 2))) | 50 .Set("manifest_version", 2) |
| 51 .Build()) |
51 .Build(); | 52 .Build(); |
52 | 53 |
53 AppWindow* app_window = new AppWindow( | 54 AppWindow* app_window = new AppWindow( |
54 browser_context.get(), new ShellAppDelegate, extension.get()); | 55 browser_context.get(), new ShellAppDelegate, extension.get()); |
55 content::WebContents* web_contents = content::WebContents::Create( | 56 content::WebContents* web_contents = content::WebContents::Create( |
56 content::WebContents::CreateParams(browser_context.get())); | 57 content::WebContents::CreateParams(browser_context.get())); |
57 app_window->SetAppWindowContentsForTesting( | 58 app_window->SetAppWindowContentsForTesting( |
58 make_scoped_ptr(new TestAppWindowContents(web_contents))); | 59 make_scoped_ptr(new TestAppWindowContents(web_contents))); |
59 | 60 |
60 AppWindow::BoundsSpecification window_spec; | 61 AppWindow::BoundsSpecification window_spec; |
61 window_spec.bounds = gfx::Rect(100, 200, 300, 400); | 62 window_spec.bounds = gfx::Rect(100, 200, 300, 400); |
62 AppWindow::CreateParams params; | 63 AppWindow::CreateParams params; |
63 params.window_spec = window_spec; | 64 params.window_spec = window_spec; |
64 | 65 |
65 ShellNativeAppWindowAura window(app_window, params); | 66 ShellNativeAppWindowAura window(app_window, params); |
66 | 67 |
67 gfx::Rect bounds = window.GetBounds(); | 68 gfx::Rect bounds = window.GetBounds(); |
68 EXPECT_EQ(window_spec.bounds, bounds); | 69 EXPECT_EQ(window_spec.bounds, bounds); |
69 | 70 |
70 // Delete the AppWindow. | 71 // Delete the AppWindow. |
71 app_window->OnNativeClose(); | 72 app_window->OnNativeClose(); |
72 } | 73 } |
73 | 74 |
74 } // namespace extensions | 75 } // namespace extensions |
OLD | NEW |