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

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

Issue 1395103003: Don't use base::MessageLoop::{Quit,QuitClosure} in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 <string>
6 6
7 #include <shlobj.h> // Must be before propkey. 7 #include <shlobj.h> // Must be before propkey.
8 #include <propkey.h> 8 #include <propkey.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 10
(...skipping 30 matching lines...) Expand all
41 41
42 typedef ExtensionBrowserTest BrowserWindowPropertyManagerTest; 42 typedef ExtensionBrowserTest BrowserWindowPropertyManagerTest;
43 43
44 namespace { 44 namespace {
45 45
46 // An observer that resumes test code after a new profile is initialized by 46 // An observer that resumes test code after a new profile is initialized by
47 // quitting the message loop it's blocked on. 47 // quitting the message loop it's blocked on.
48 void UnblockOnProfileCreation(Profile* profile, 48 void UnblockOnProfileCreation(Profile* profile,
49 Profile::CreateStatus status) { 49 Profile::CreateStatus status) {
50 if (status == Profile::CREATE_STATUS_INITIALIZED) 50 if (status == Profile::CREATE_STATUS_INITIALIZED)
51 base::MessageLoop::current()->Quit(); 51 base::MessageLoop::current()->QuitWhenIdle();
52 } 52 }
53 53
54 // Checks that the relaunch name, relaunch command and app icon for the given 54 // Checks that the relaunch name, relaunch command and app icon for the given
55 // |browser| are correct. 55 // |browser| are correct.
56 void ValidateBrowserWindowProperties( 56 void ValidateBrowserWindowProperties(
57 const Browser* browser, 57 const Browser* browser,
58 const base::string16& expected_profile_name) { 58 const base::string16& expected_profile_name) {
59 HWND hwnd = views::HWNDForNativeWindow(browser->window()->GetNativeWindow()); 59 HWND hwnd = views::HWNDForNativeWindow(browser->window()->GetNativeWindow());
60 60
61 base::win::ScopedComPtr<IPropertyStore> pps; 61 base::win::ScopedComPtr<IPropertyStore> pps;
(...skipping 26 matching lines...) Expand all
88 prop_var.Reset(); 88 prop_var.Reset();
89 89
90 // The app icon should be set to the profile icon. 90 // The app icon should be set to the profile icon.
91 EXPECT_EQ(S_OK, pps->GetValue(PKEY_AppUserModel_RelaunchIconResource, 91 EXPECT_EQ(S_OK, pps->GetValue(PKEY_AppUserModel_RelaunchIconResource,
92 prop_var.Receive())); 92 prop_var.Receive()));
93 EXPECT_EQ(VT_LPWSTR, prop_var.get().vt); 93 EXPECT_EQ(VT_LPWSTR, prop_var.get().vt);
94 EXPECT_EQ(profiles::internal::GetProfileIconPath( 94 EXPECT_EQ(profiles::internal::GetProfileIconPath(
95 browser->profile()->GetPath()).value(), 95 browser->profile()->GetPath()).value(),
96 prop_var.get().pwszVal); 96 prop_var.get().pwszVal);
97 prop_var.Reset(); 97 prop_var.Reset();
98 base::MessageLoop::current()->Quit(); 98 base::MessageLoop::current()->QuitWhenIdle();
99 } 99 }
100 100
101 void ValidateHostedAppWindowProperties(const Browser* browser, 101 void ValidateHostedAppWindowProperties(const Browser* browser,
102 const extensions::Extension* extension) { 102 const extensions::Extension* extension) {
103 HWND hwnd = views::HWNDForNativeWindow(browser->window()->GetNativeWindow()); 103 HWND hwnd = views::HWNDForNativeWindow(browser->window()->GetNativeWindow());
104 104
105 base::win::ScopedComPtr<IPropertyStore> pps; 105 base::win::ScopedComPtr<IPropertyStore> pps;
106 HRESULT result = 106 HRESULT result =
107 SHGetPropertyStoreForWindow(hwnd, IID_IPropertyStore, pps.ReceiveVoid()); 107 SHGetPropertyStoreForWindow(hwnd, IID_IPropertyStore, pps.ReceiveVoid());
108 EXPECT_TRUE(SUCCEEDED(result)); 108 EXPECT_TRUE(SUCCEEDED(result));
(...skipping 24 matching lines...) Expand all
133 base::FilePath web_app_dir = web_app::GetWebAppDataDirectory( 133 base::FilePath web_app_dir = web_app::GetWebAppDataDirectory(
134 browser->profile()->GetPath(), extension->id(), GURL()); 134 browser->profile()->GetPath(), extension->id(), GURL());
135 EXPECT_EQ(S_OK, 135 EXPECT_EQ(S_OK,
136 pps->GetValue(PKEY_AppUserModel_RelaunchIconResource, 136 pps->GetValue(PKEY_AppUserModel_RelaunchIconResource,
137 prop_var.Receive())); 137 prop_var.Receive()));
138 EXPECT_EQ(VT_LPWSTR, prop_var.get().vt); 138 EXPECT_EQ(VT_LPWSTR, prop_var.get().vt);
139 EXPECT_EQ(web_app::internals::GetIconFilePath( 139 EXPECT_EQ(web_app::internals::GetIconFilePath(
140 web_app_dir, base::UTF8ToUTF16(extension->name())).value(), 140 web_app_dir, base::UTF8ToUTF16(extension->name())).value(),
141 prop_var.get().pwszVal); 141 prop_var.get().pwszVal);
142 prop_var.Reset(); 142 prop_var.Reset();
143 base::MessageLoop::current()->Quit(); 143 base::MessageLoop::current()->QuitWhenIdle();
144 } 144 }
145 145
146 void PostValidationTaskToUIThread(const base::Closure& validation_task) { 146 void PostValidationTaskToUIThread(const base::Closure& validation_task) {
147 content::BrowserThread::PostTask( 147 content::BrowserThread::PostTask(
148 content::BrowserThread::UI, FROM_HERE, validation_task); 148 content::BrowserThread::UI, FROM_HERE, validation_task);
149 } 149 }
150 150
151 // Posts a validation task to the FILE thread which bounces back to the UI 151 // Posts a validation task to the FILE thread which bounces back to the UI
152 // thread and then does validation. This is necessary because the icon profile 152 // thread and then does validation. This is necessary because the icon profile
153 // pref only gets set at the end of icon creation (which happens on the FILE 153 // pref only gets set at the end of icon creation (which happens on the FILE
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 for (chrome::BrowserIterator it; !it.done() && !app_browser; it.Next()) { 263 for (chrome::BrowserIterator it; !it.done() && !app_browser; it.Next()) {
264 if (*it != browser()) 264 if (*it != browser())
265 app_browser = *it; 265 app_browser = *it;
266 } 266 }
267 ASSERT_TRUE(app_browser); 267 ASSERT_TRUE(app_browser);
268 ASSERT_TRUE(app_browser != browser()); 268 ASSERT_TRUE(app_browser != browser());
269 269
270 WaitAndValidateBrowserWindowProperties( 270 WaitAndValidateBrowserWindowProperties(
271 base::Bind(&ValidateHostedAppWindowProperties, app_browser, extension)); 271 base::Bind(&ValidateHostedAppWindowProperties, app_browser, extension));
272 } 272 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc ('k') | chrome/browser/ui/views/keyboard_access_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698