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

Side by Side Diff: chrome/browser/extensions/api/instance_id/instance_id_apitest.cc

Issue 1854093002: Enable InstanceID field trial by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iid3test
Patch Set: Rebase Created 4 years, 8 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
« no previous file with comments | « no previous file | components/gcm_driver/gcm_driver_desktop_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <utility> 5 #include <utility>
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
jianli 2016/04/08 00:20:43 nit: remove this
johnme 2016/04/08 13:19:43 Done.
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "chrome/browser/extensions/api/instance_id/instance_id_api.h" 11 #include "chrome/browser/extensions/api/instance_id/instance_id_api.h"
12 #include "chrome/browser/extensions/extension_apitest.h" 12 #include "chrome/browser/extensions/extension_apitest.h"
13 #include "chrome/browser/extensions/extension_gcm_app_handler.h" 13 #include "chrome/browser/extensions/extension_gcm_app_handler.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" 15 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h"
16 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" 16 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
17 #include "chrome/browser/services/gcm/instance_id/instance_id_profile_service_fa ctory.h" 17 #include "chrome/browser/services/gcm/instance_id/instance_id_profile_service_fa ctory.h"
(...skipping 17 matching lines...) Expand all
35 } 35 }
36 36
37 } // namespace 37 } // namespace
38 38
39 class InstanceIDApiTest : public ExtensionApiTest { 39 class InstanceIDApiTest : public ExtensionApiTest {
40 public: 40 public:
41 InstanceIDApiTest(); 41 InstanceIDApiTest();
42 42
43 protected: 43 protected:
44 void SetUpOnMainThread() override; 44 void SetUpOnMainThread() override;
45 void SetUpCommandLine(base::CommandLine* command_line) override;
46 45
47 private: 46 private:
48 DISALLOW_COPY_AND_ASSIGN(InstanceIDApiTest); 47 DISALLOW_COPY_AND_ASSIGN(InstanceIDApiTest);
49 }; 48 };
50 49
51 InstanceIDApiTest::InstanceIDApiTest() { 50 InstanceIDApiTest::InstanceIDApiTest() {
52 } 51 }
53 52
54 void InstanceIDApiTest::SetUpOnMainThread() { 53 void InstanceIDApiTest::SetUpOnMainThread() {
55 gcm::GCMProfileServiceFactory::GetInstance()->SetTestingFactory( 54 gcm::GCMProfileServiceFactory::GetInstance()->SetTestingFactory(
56 browser()->profile(), &BuildFakeGCMProfileService); 55 browser()->profile(), &BuildFakeGCMProfileService);
57 56
58 ExtensionApiTest::SetUpOnMainThread(); 57 ExtensionApiTest::SetUpOnMainThread();
59 } 58 }
60 59
61 void InstanceIDApiTest::SetUpCommandLine(base::CommandLine* command_line) {
62 ExtensionApiTest::SetUpCommandLine(command_line);
63
64 // Makes sure InstanceID is enabled for testing.
65 command_line->AppendSwitchASCII(
66 switches::kForceFieldTrials, "InstanceID/Enabled/");
67 }
68
69 IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, GetID) { 60 IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, GetID) {
70 ASSERT_TRUE(RunExtensionTest("instance_id/get_id")); 61 ASSERT_TRUE(RunExtensionTest("instance_id/get_id"));
71 } 62 }
72 63
73 IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, GetCreationTime) { 64 IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, GetCreationTime) {
74 ASSERT_TRUE(RunExtensionTest("instance_id/get_creation_time")); 65 ASSERT_TRUE(RunExtensionTest("instance_id/get_creation_time"));
75 } 66 }
76 67
77 IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, DeleteID) { 68 IN_PROC_BROWSER_TEST_F(InstanceIDApiTest, DeleteID) {
78 ASSERT_TRUE(RunExtensionTest("instance_id/delete_id")); 69 ASSERT_TRUE(RunExtensionTest("instance_id/delete_id"));
(...skipping 14 matching lines...) Expand all
93 incognito_catcher.RestrictToBrowserContext( 84 incognito_catcher.RestrictToBrowserContext(
94 profile()->GetOffTheRecordProfile()); 85 profile()->GetOffTheRecordProfile());
95 86
96 ASSERT_TRUE(RunExtensionTestIncognito("instance_id/incognito")); 87 ASSERT_TRUE(RunExtensionTestIncognito("instance_id/incognito"));
97 88
98 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 89 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
99 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message(); 90 EXPECT_TRUE(incognito_catcher.GetNextResult()) << incognito_catcher.message();
100 } 91 }
101 92
102 } // namespace extensions 93 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | components/gcm_driver/gcm_driver_desktop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698