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

Side by Side Diff: chrome/browser/ui/views/frame/browser_window_property_manager_browsertest_win.cc

Issue 2830893004: Migrate IID Coupled Uses of ScopedComPtr::ReceiveVoid() to IID_PPV_ARGS (Closed)
Patch Set: Created 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <string> 5 #include <objbase.h>
6
7 #include <shlobj.h> // Must be before propkey. 6 #include <shlobj.h> // Must be before propkey.
8 #include <propkey.h> 7 #include <propkey.h>
9 #include <shellapi.h> 8 #include <shellapi.h>
10 #include <stddef.h> 9 #include <stddef.h>
11 10
11 #include <string>
12
12 #include "base/command_line.h" 13 #include "base/command_line.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
15 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
16 #include "base/win/scoped_comptr.h" 17 #include "base/win/scoped_comptr.h"
17 #include "base/win/scoped_propvariant.h" 18 #include "base/win/scoped_propvariant.h"
18 #include "base/win/windows_version.h" 19 #include "base/win/windows_version.h"
19 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/extensions/extension_browsertest.h" 21 #include "chrome/browser/extensions/extension_browsertest.h"
21 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 55 }
55 56
56 // Checks that the relaunch name, relaunch command and app icon for the given 57 // Checks that the relaunch name, relaunch command and app icon for the given
57 // |browser| are correct. 58 // |browser| are correct.
58 void ValidateBrowserWindowProperties( 59 void ValidateBrowserWindowProperties(
59 const Browser* browser, 60 const Browser* browser,
60 const base::string16& expected_profile_name) { 61 const base::string16& expected_profile_name) {
61 HWND hwnd = views::HWNDForNativeWindow(browser->window()->GetNativeWindow()); 62 HWND hwnd = views::HWNDForNativeWindow(browser->window()->GetNativeWindow());
62 63
63 base::win::ScopedComPtr<IPropertyStore> pps; 64 base::win::ScopedComPtr<IPropertyStore> pps;
64 HRESULT result = SHGetPropertyStoreForWindow(hwnd, IID_IPropertyStore, 65 HRESULT result = SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pps));
65 pps.ReceiveVoid());
66 EXPECT_TRUE(SUCCEEDED(result)); 66 EXPECT_TRUE(SUCCEEDED(result));
67 67
68 base::win::ScopedPropVariant prop_var; 68 base::win::ScopedPropVariant prop_var;
69 // The relaunch name should be of the form "Chromium" if there is only 1 69 // The relaunch name should be of the form "Chromium" if there is only 1
70 // profile and "First User - Chromium" if there are more. The expected value 70 // profile and "First User - Chromium" if there are more. The expected value
71 // is given by |expected_profile_name|. 71 // is given by |expected_profile_name|.
72 EXPECT_EQ(S_OK, pps->GetValue(PKEY_AppUserModel_RelaunchDisplayNameResource, 72 EXPECT_EQ(S_OK, pps->GetValue(PKEY_AppUserModel_RelaunchDisplayNameResource,
73 prop_var.Receive())); 73 prop_var.Receive()));
74 EXPECT_EQ(VT_LPWSTR, prop_var.get().vt); 74 EXPECT_EQ(VT_LPWSTR, prop_var.get().vt);
75 EXPECT_EQ( 75 EXPECT_EQ(
(...skipping 22 matching lines...) Expand all
98 prop_var.get().pwszVal); 98 prop_var.get().pwszVal);
99 prop_var.Reset(); 99 prop_var.Reset();
100 base::MessageLoop::current()->QuitWhenIdle(); 100 base::MessageLoop::current()->QuitWhenIdle();
101 } 101 }
102 102
103 void ValidateHostedAppWindowProperties(const Browser* browser, 103 void ValidateHostedAppWindowProperties(const Browser* browser,
104 const extensions::Extension* extension) { 104 const extensions::Extension* extension) {
105 HWND hwnd = views::HWNDForNativeWindow(browser->window()->GetNativeWindow()); 105 HWND hwnd = views::HWNDForNativeWindow(browser->window()->GetNativeWindow());
106 106
107 base::win::ScopedComPtr<IPropertyStore> pps; 107 base::win::ScopedComPtr<IPropertyStore> pps;
108 HRESULT result = 108 HRESULT result = SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pps));
109 SHGetPropertyStoreForWindow(hwnd, IID_IPropertyStore, pps.ReceiveVoid());
110 EXPECT_TRUE(SUCCEEDED(result)); 109 EXPECT_TRUE(SUCCEEDED(result));
111 110
112 base::win::ScopedPropVariant prop_var; 111 base::win::ScopedPropVariant prop_var;
113 // The relaunch name should be the extension name. 112 // The relaunch name should be the extension name.
114 EXPECT_EQ(S_OK, 113 EXPECT_EQ(S_OK,
115 pps->GetValue(PKEY_AppUserModel_RelaunchDisplayNameResource, 114 pps->GetValue(PKEY_AppUserModel_RelaunchDisplayNameResource,
116 prop_var.Receive())); 115 prop_var.Receive()));
117 EXPECT_EQ(VT_LPWSTR, prop_var.get().vt); 116 EXPECT_EQ(VT_LPWSTR, prop_var.get().vt);
118 EXPECT_EQ(base::UTF8ToWide(extension->name()), prop_var.get().pwszVal); 117 EXPECT_EQ(base::UTF8ToWide(extension->name()), prop_var.get().pwszVal);
119 prop_var.Reset(); 118 prop_var.Reset();
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 for (auto* b : *BrowserList::GetInstance()) { 251 for (auto* b : *BrowserList::GetInstance()) {
253 if (b != browser()) 252 if (b != browser())
254 app_browser = b; 253 app_browser = b;
255 } 254 }
256 ASSERT_TRUE(app_browser); 255 ASSERT_TRUE(app_browser);
257 ASSERT_TRUE(app_browser != browser()); 256 ASSERT_TRUE(app_browser != browser());
258 257
259 WaitAndValidateBrowserWindowProperties( 258 WaitAndValidateBrowserWindowProperties(
260 base::Bind(&ValidateHostedAppWindowProperties, app_browser, extension)); 259 base::Bind(&ValidateHostedAppWindowProperties, app_browser, extension));
261 } 260 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/antivirus_metrics_provider_win.cc ('k') | chrome/browser/win/jumplist_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698