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

Side by Side Diff: extensions/shell/browser/shell_native_app_window_aura_unittest.cc

Issue 696063008: Refactor ShellDesktopController and ShellNativeAppWindow to allow for non-aura implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: + Created 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "extensions/shell/browser/shell_native_app_window_aura.h"
6
7 #include "base/memory/scoped_ptr.h"
8 #include "content/public/browser/browser_context.h"
9 #include "content/public/browser/notification_service.h"
10 #include "content/public/browser/web_contents.h"
11 #include "content/public/test/test_browser_context.h"
12 #include "content/public/test/test_browser_thread_bundle.h"
13 #include "extensions/browser/app_window/app_window.h"
14 #include "extensions/browser/app_window/test_app_window_contents.h"
15 #include "extensions/browser/extensions_test.h"
16 #include "extensions/common/extension.h"
17 #include "extensions/common/extension_builder.h"
18 #include "extensions/shell/browser/desktop_controller.h"
19 #include "extensions/shell/browser/shell_app_delegate.h"
20 #include "extensions/shell/browser/shell_app_window_client.h"
21 #include "ui/gfx/geometry/rect.h"
22
23 namespace extensions {
24
25 class ShellNativeAppWindowAuraTest : public ExtensionsTest {
26 public:
27 ShellNativeAppWindowAuraTest()
28 : notification_service_(content::NotificationService::Create()) {
29 AppWindowClient::Set(&app_window_client_);
30 }
31
32 ~ShellNativeAppWindowAuraTest() override {}
33
34 protected:
35 content::TestBrowserThreadBundle thread_bundle_;
36 scoped_ptr<content::NotificationService> notification_service_;
37 ShellAppWindowClient app_window_client_;
38 };
39
40 TEST_F(ShellNativeAppWindowAuraTest, Bounds) {
41 // The BrowserContext used here must be destroyed before the thread bundle,
42 // because of destructors of things spawned from creating a WebContents.
43 scoped_ptr<content::BrowserContext> browser_context(
44 new content::TestBrowserContext);
45 scoped_refptr<Extension> extension =
46 ExtensionBuilder()
47 .SetManifest(DictionaryBuilder()
48 .Set("name", "test extension")
49 .Set("version", "1")
50 .Set("manifest_version", 2))
51 .Build();
52
53 AppWindow* app_window = new AppWindow(
54 browser_context.get(), new ShellAppDelegate, extension.get());
55 content::WebContents* web_contents = content::WebContents::Create(
56 content::WebContents::CreateParams(browser_context.get()));
57 app_window->SetAppWindowContentsForTesting(
58 make_scoped_ptr(new TestAppWindowContents(web_contents)));
59
60 AppWindow::BoundsSpecification window_spec;
61 window_spec.bounds = gfx::Rect(100, 200, 300, 400);
62 AppWindow::CreateParams params;
63 params.window_spec = window_spec;
64
65 ShellNativeAppWindowAura window(app_window, params);
66
67 gfx::Rect bounds = window.GetBounds();
68 EXPECT_EQ(window_spec.bounds, bounds);
69
70 // Delete the AppWindow.
71 app_window->OnNativeClose();
72 }
73
74 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/shell/browser/shell_native_app_window_aura.cc ('k') | extensions/shell/test/shell_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698