OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/content_settings/cookie_settings.h" | 5 #include "chrome/browser/content_settings/cookie_settings.h" |
6 #include "chrome/browser/prefs/pref_service.h" | 6 #include "chrome/browser/prefs/pref_service.h" |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
9 #include "chrome/browser/signin/signin_manager_factory.h" | 9 #include "chrome/browser/signin/signin_manager_factory.h" |
10 #include "chrome/browser/signin/signin_manager_fake.h" | 10 #include "chrome/browser/signin/signin_manager_fake.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 SigninManager* signin_manager_; | 60 SigninManager* signin_manager_; |
61 | 61 |
62 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelperTest); | 62 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelperTest); |
63 }; | 63 }; |
64 | 64 |
65 void OneClickSigninHelperTest::TearDown() { | 65 void OneClickSigninHelperTest::TearDown() { |
66 // Destroy things in proper order. | 66 // Destroy things in proper order. |
67 web_contents_.reset(); | 67 web_contents_.reset(); |
68 profile_.reset(); | 68 profile_.reset(); |
69 ui_thread_.reset(); | 69 ui_thread_.reset(); |
70 MessageLoop::current()->RunAllPending(); | |
Roger Tawa OOO till Jul 10th
2012/06/01 13:56:42
Are you sure this should/can be done after destroy
James Hawkins
2012/06/01 23:53:13
In what context are you asking this question? Wha
Roger Tawa OOO till Jul 10th
2012/06/04 14:50:40
My concern is calling RunAllPending() after the de
| |
70 } | 71 } |
71 | 72 |
72 void OneClickSigninHelperTest::MarkCurrentThreadAsUIThread() { | 73 void OneClickSigninHelperTest::MarkCurrentThreadAsUIThread() { |
73 ui_thread_.reset(new content::TestBrowserThread( | 74 ui_thread_.reset(new content::TestBrowserThread( |
74 content::BrowserThread::UI, &message_loop_)); | 75 content::BrowserThread::UI, &message_loop_)); |
75 } | 76 } |
76 | 77 |
77 content::WebContents* OneClickSigninHelperTest::CreateMockWebContents( | 78 content::WebContents* OneClickSigninHelperTest::CreateMockWebContents( |
78 bool use_incognito) { | 79 bool use_incognito) { |
79 EXPECT_TRUE(web_contents_.get() == NULL); | 80 EXPECT_TRUE(web_contents_.get() == NULL); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 } | 146 } |
146 | 147 |
147 TEST_F(OneClickSigninHelperTest, CanOfferNoSigninCookies) { | 148 TEST_F(OneClickSigninHelperTest, CanOfferNoSigninCookies) { |
148 MarkCurrentThreadAsUIThread(); | 149 MarkCurrentThreadAsUIThread(); |
149 content::WebContents* web_contents = CreateMockWebContents(true); | 150 content::WebContents* web_contents = CreateMockWebContents(true); |
150 AllowSigninCookies(false); | 151 AllowSigninCookies(false); |
151 | 152 |
152 EXPECT_FALSE(OneClickSigninHelper::CanOffer(web_contents, true)); | 153 EXPECT_FALSE(OneClickSigninHelper::CanOffer(web_contents, true)); |
153 EXPECT_FALSE(OneClickSigninHelper::CanOffer(web_contents, false)); | 154 EXPECT_FALSE(OneClickSigninHelper::CanOffer(web_contents, false)); |
154 } | 155 } |
OLD | NEW |