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

Side by Side Diff: chrome/browser/extensions/api/gcm/gcm_apitest.cc

Issue 2961033002: Use ContainsValue() instead of std::find() in chrome/browser/extensions (Closed)
Patch Set: Reverted code changes in language_settings_private_api.cc:307 Created 3 years, 5 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 "base/run_loop.h" 5 #include "base/run_loop.h"
6 #include "base/stl_util.h"
6 #include "chrome/browser/extensions/api/gcm/gcm_api.h" 7 #include "chrome/browser/extensions/api/gcm/gcm_api.h"
7 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/browser/extensions/extension_gcm_app_handler.h" 9 #include "chrome/browser/extensions/extension_gcm_app_handler.h"
9 #include "chrome/browser/gcm/fake_gcm_profile_service.h" 10 #include "chrome/browser/gcm/fake_gcm_profile_service.h"
10 #include "chrome/browser/gcm/gcm_profile_service_factory.h" 11 #include "chrome/browser/gcm/gcm_profile_service_factory.h"
11 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
13 #include "chrome/test/base/ui_test_utils.h" 14 #include "chrome/test/base/ui_test_utils.h"
14 #include "components/browser_sync/browser_sync_switches.h" 15 #include "components/browser_sync/browser_sync_switches.h"
15 #include "extensions/test/result_catcher.h" 16 #include "extensions/test/result_catcher.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 IN_PROC_BROWSER_TEST_F(GcmApiTest, RegisterValidation) { 117 IN_PROC_BROWSER_TEST_F(GcmApiTest, RegisterValidation) {
117 ASSERT_TRUE(RunExtensionTest("gcm/functions/register_validation")); 118 ASSERT_TRUE(RunExtensionTest("gcm/functions/register_validation"));
118 } 119 }
119 120
120 IN_PROC_BROWSER_TEST_F(GcmApiTest, Register) { 121 IN_PROC_BROWSER_TEST_F(GcmApiTest, Register) {
121 StartCollecting(); 122 StartCollecting();
122 ASSERT_TRUE(RunExtensionTest("gcm/functions/register")); 123 ASSERT_TRUE(RunExtensionTest("gcm/functions/register"));
123 124
124 const std::vector<std::string>& sender_ids = 125 const std::vector<std::string>& sender_ids =
125 service()->last_registered_sender_ids(); 126 service()->last_registered_sender_ids();
126 EXPECT_TRUE(std::find(sender_ids.begin(), sender_ids.end(), "Sender1") != 127 EXPECT_TRUE(base::ContainsValue(sender_ids, "Sender1"));
127 sender_ids.end()); 128 EXPECT_TRUE(base::ContainsValue(sender_ids, "Sender2"));
128 EXPECT_TRUE(std::find(sender_ids.begin(), sender_ids.end(), "Sender2") !=
129 sender_ids.end());
130 } 129 }
131 130
132 IN_PROC_BROWSER_TEST_F(GcmApiTest, Unregister) { 131 IN_PROC_BROWSER_TEST_F(GcmApiTest, Unregister) {
133 service()->AddExpectedUnregisterResponse(gcm::GCMClient::SUCCESS); 132 service()->AddExpectedUnregisterResponse(gcm::GCMClient::SUCCESS);
134 service()->AddExpectedUnregisterResponse(gcm::GCMClient::SERVER_ERROR); 133 service()->AddExpectedUnregisterResponse(gcm::GCMClient::SERVER_ERROR);
135 134
136 ASSERT_TRUE(RunExtensionTest("gcm/functions/unregister")); 135 ASSERT_TRUE(RunExtensionTest("gcm/functions/unregister"));
137 } 136 }
138 137
139 IN_PROC_BROWSER_TEST_F(GcmApiTest, SendValidation) { 138 IN_PROC_BROWSER_TEST_F(GcmApiTest, SendValidation) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 incognito_catcher.RestrictToBrowserContext( 258 incognito_catcher.RestrictToBrowserContext(
260 profile()->GetOffTheRecordProfile()); 259 profile()->GetOffTheRecordProfile());
261 260
262 ASSERT_TRUE(RunExtensionTestIncognito("gcm/functions/incognito")); 261 ASSERT_TRUE(RunExtensionTestIncognito("gcm/functions/incognito"));
263 262
264 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 263 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
265 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message(); 264 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message();
266 } 265 }
267 266
268 } // namespace extensions 267 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698