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

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

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

Powered by Google App Engine
This is Rietveld 408576698