| OLD | NEW |
| 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/prefs/pref_service.h" | 5 #include "base/prefs/pref_service.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "chrome/browser/extensions/api/gcm/gcm_api.h" | 7 #include "chrome/browser/extensions/api/gcm/gcm_api.h" |
| 8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/browser/extensions/extension_gcm_app_handler.h" | 9 #include "chrome/browser/extensions/extension_gcm_app_handler.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 namespace extensions { | 57 namespace extensions { |
| 58 | 58 |
| 59 class GcmApiTest : public ExtensionApiTest { | 59 class GcmApiTest : public ExtensionApiTest { |
| 60 public: | 60 public: |
| 61 GcmApiTest() : fake_gcm_profile_service_(NULL) {} | 61 GcmApiTest() : fake_gcm_profile_service_(NULL) {} |
| 62 | 62 |
| 63 protected: | 63 protected: |
| 64 void SetUpCommandLine(CommandLine* command_line) override; | 64 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 65 void SetUpOnMainThread() override; | 65 void SetUpOnMainThread() override; |
| 66 | 66 |
| 67 void StartCollecting(); | 67 void StartCollecting(); |
| 68 | 68 |
| 69 const Extension* LoadTestExtension(const std::string& extension_path, | 69 const Extension* LoadTestExtension(const std::string& extension_path, |
| 70 const std::string& page_name); | 70 const std::string& page_name); |
| 71 gcm::FakeGCMProfileService* service() const; | 71 gcm::FakeGCMProfileService* service() const; |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 gcm::FakeGCMProfileService* fake_gcm_profile_service_; | 74 gcm::FakeGCMProfileService* fake_gcm_profile_service_; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 void GcmApiTest::SetUpCommandLine(CommandLine* command_line) { | 77 void GcmApiTest::SetUpCommandLine(base::CommandLine* command_line) { |
| 78 // We now always create the GCMProfileService instance in | 78 // We now always create the GCMProfileService instance in |
| 79 // ProfileSyncServiceFactory that is called when a profile is being | 79 // ProfileSyncServiceFactory that is called when a profile is being |
| 80 // initialized. In order to prevent it from being created, we add the switch | 80 // initialized. In order to prevent it from being created, we add the switch |
| 81 // to disable the sync logic. | 81 // to disable the sync logic. |
| 82 command_line->AppendSwitch(switches::kDisableSync); | 82 command_line->AppendSwitch(switches::kDisableSync); |
| 83 | 83 |
| 84 ExtensionApiTest::SetUpCommandLine(command_line); | 84 ExtensionApiTest::SetUpCommandLine(command_line); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void GcmApiTest::SetUpOnMainThread() { | 87 void GcmApiTest::SetUpOnMainThread() { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 incognito_catcher.RestrictToBrowserContext( | 265 incognito_catcher.RestrictToBrowserContext( |
| 266 profile()->GetOffTheRecordProfile()); | 266 profile()->GetOffTheRecordProfile()); |
| 267 | 267 |
| 268 ASSERT_TRUE(RunExtensionTestIncognito("gcm/functions/incognito")); | 268 ASSERT_TRUE(RunExtensionTestIncognito("gcm/functions/incognito")); |
| 269 | 269 |
| 270 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 270 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 271 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message(); | 271 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message(); |
| 272 } | 272 } |
| 273 | 273 |
| 274 } // namespace extensions | 274 } // namespace extensions |
| OLD | NEW |