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

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

Issue 130473002: [GCM] Make GCM API not work in incognito mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch to land Created 6 years, 11 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 | Annotate | Revision Log
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 "chrome/browser/extensions/api/gcm/gcm_api.h" 6 #include "chrome/browser/extensions/api/gcm/gcm_api.h"
7 #include "chrome/browser/extensions/extension_apitest.h" 7 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" 9 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h"
10 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" 10 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
(...skipping 12 matching lines...) Expand all
23 public: 23 public:
24 GcmApiTest() : fake_gcm_profile_service_(NULL) {} 24 GcmApiTest() : fake_gcm_profile_service_(NULL) {}
25 25
26 protected: 26 protected:
27 virtual void SetUpOnMainThread() OVERRIDE; 27 virtual void SetUpOnMainThread() OVERRIDE;
28 28
29 void StartCollecting(); 29 void StartCollecting();
30 30
31 const Extension* LoadTestExtension(const std::string& extension_path, 31 const Extension* LoadTestExtension(const std::string& extension_path,
32 const std::string& page_name); 32 const std::string& page_name);
33
34 gcm::FakeGCMProfileService* service() const; 33 gcm::FakeGCMProfileService* service() const;
35 bool ShouldSkipTest() const; 34 bool ShouldSkipTest() const;
36 35
37 private: 36 private:
38 gcm::FakeGCMProfileService* fake_gcm_profile_service_; 37 gcm::FakeGCMProfileService* fake_gcm_profile_service_;
39 }; 38 };
40 39
41 void GcmApiTest::SetUpOnMainThread() { 40 void GcmApiTest::SetUpOnMainThread() {
42 gcm::GCMProfileServiceFactory::GetInstance()->SetTestingFactory( 41 gcm::GCMProfileServiceFactory::GetInstance()->SetTestingFactory(
43 browser()->profile(), &gcm::FakeGCMProfileService::Build); 42 browser()->profile(), &gcm::FakeGCMProfileService::Build);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 router.OnSendError(extension->id(), "error_message_3", 177 router.OnSendError(extension->id(), "error_message_3",
179 gcm::GCMClient::NETWORK_ERROR); 178 gcm::GCMClient::NETWORK_ERROR);
180 router.OnSendError(extension->id(), "error_message_4", 179 router.OnSendError(extension->id(), "error_message_4",
181 gcm::GCMClient::UNKNOWN_ERROR); 180 gcm::GCMClient::UNKNOWN_ERROR);
182 router.OnSendError(extension->id(), "error_message_5", 181 router.OnSendError(extension->id(), "error_message_5",
183 gcm::GCMClient::TTL_EXCEEDED); 182 gcm::GCMClient::TTL_EXCEEDED);
184 183
185 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 184 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
186 } 185 }
187 186
187 IN_PROC_BROWSER_TEST_F(GcmApiTest, Incognito) {
188 if (ShouldSkipTest())
189 return;
190
191 ResultCatcher catcher;
192 catcher.RestrictToProfile(profile());
193 ResultCatcher incognito_catcher;
194 incognito_catcher.RestrictToProfile(profile()->GetOffTheRecordProfile());
195
196 ASSERT_TRUE(RunExtensionTestIncognito("gcm/functions/incognito"));
197
198 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
199 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message();
200 }
201
188 } // namespace extensions 202 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/gcm/gcm_api.cc ('k') | chrome/browser/services/gcm/gcm_profile_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698