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

Side by Side Diff: chrome/browser/services/gcm/gcm_profile_service_unittest.cc

Issue 1165913002: [Cleanup] Used scoped pointers in KeyedServiceFactory's SetTestingFactory functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 6 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 "chrome/browser/services/gcm/gcm_profile_service.h" 5 #include "chrome/browser/services/gcm/gcm_profile_service.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 17 matching lines...) Expand all
28 #include "content/public/test/test_browser_thread_bundle.h" 28 #include "content/public/test/test_browser_thread_bundle.h"
29 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
30 30
31 namespace gcm { 31 namespace gcm {
32 32
33 namespace { 33 namespace {
34 34
35 const char kTestAppID[] = "TestApp"; 35 const char kTestAppID[] = "TestApp";
36 const char kUserID[] = "user"; 36 const char kUserID[] = "user";
37 37
38 KeyedService* BuildGCMProfileService(content::BrowserContext* context) { 38 scoped_ptr<KeyedService> BuildGCMProfileService(
39 return new GCMProfileService( 39 content::BrowserContext* context) {
40 return make_scoped_ptr(new GCMProfileService(
40 Profile::FromBrowserContext(context), 41 Profile::FromBrowserContext(context),
41 scoped_ptr<GCMClientFactory>(new FakeGCMClientFactory( 42 scoped_ptr<GCMClientFactory>(new FakeGCMClientFactory(
42 content::BrowserThread::GetMessageLoopProxyForThread( 43 content::BrowserThread::GetMessageLoopProxyForThread(
43 content::BrowserThread::UI), 44 content::BrowserThread::UI),
44 content::BrowserThread::GetMessageLoopProxyForThread( 45 content::BrowserThread::GetMessageLoopProxyForThread(
45 content::BrowserThread::IO)))); 46 content::BrowserThread::IO)))));
46 } 47 }
47 48
48 } // namespace 49 } // namespace
49 50
50 class GCMProfileServiceTest : public testing::Test { 51 class GCMProfileServiceTest : public testing::Test {
51 protected: 52 protected:
52 GCMProfileServiceTest(); 53 GCMProfileServiceTest();
53 ~GCMProfileServiceTest() override; 54 ~GCMProfileServiceTest() override;
54 55
55 // testing::Test: 56 // testing::Test:
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 UnregisterAndWaitForCompletion(); 211 UnregisterAndWaitForCompletion();
211 EXPECT_EQ(GCMClient::SUCCESS, unregistration_result()); 212 EXPECT_EQ(GCMClient::SUCCESS, unregistration_result());
212 } 213 }
213 214
214 TEST_F(GCMProfileServiceTest, Send) { 215 TEST_F(GCMProfileServiceTest, Send) {
215 CreateGCMProfileService(); 216 CreateGCMProfileService();
216 217
217 GCMClient::OutgoingMessage message; 218 GCMClient::OutgoingMessage message;
218 message.id = "1"; 219 message.id = "1";
219 message.data["key1"] = "value1"; 220 message.data["key1"] = "value1";
220 SendAndWaitForCompletion( message); 221 SendAndWaitForCompletion(message);
221 222
222 EXPECT_EQ(message.id, send_message_id()); 223 EXPECT_EQ(message.id, send_message_id());
223 EXPECT_EQ(GCMClient::SUCCESS, send_result()); 224 EXPECT_EQ(GCMClient::SUCCESS, send_result());
224 } 225 }
225 226
226 } // namespace gcm 227 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698