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

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

Issue 684613002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 26 matching lines...) Expand all
37 : infobar_service_(InfoBarService::FromWebContents( 37 : infobar_service_(InfoBarService::FromWebContents(
38 browser->tab_strip_model()->GetActiveWebContents())), 38 browser->tab_strip_model()->GetActiveWebContents())),
39 accept_(accept), 39 accept_(accept),
40 has_observed_(false) { 40 has_observed_(false) {
41 infobar_service_->AddObserver(this); 41 infobar_service_->AddObserver(this);
42 } 42 }
43 43
44 virtual ~InfoBarResponder() { infobar_service_->RemoveObserver(this); } 44 virtual ~InfoBarResponder() { infobar_service_->RemoveObserver(this); }
45 45
46 // infobars::InfoBarManager::Observer 46 // infobars::InfoBarManager::Observer
47 virtual void OnInfoBarAdded(infobars::InfoBar* infobar) override { 47 void OnInfoBarAdded(infobars::InfoBar* infobar) override {
48 if (has_observed_) 48 if (has_observed_)
49 return; 49 return;
50 has_observed_ = true; 50 has_observed_ = true;
51 ConfirmInfoBarDelegate* delegate = 51 ConfirmInfoBarDelegate* delegate =
52 infobar->delegate()->AsConfirmInfoBarDelegate(); 52 infobar->delegate()->AsConfirmInfoBarDelegate();
53 DCHECK(delegate); 53 DCHECK(delegate);
54 54
55 // Respond to the infobar asynchronously, like a person. 55 // Respond to the infobar asynchronously, like a person.
56 base::MessageLoop::current()->PostTask( 56 base::MessageLoop::current()->PostTask(
57 FROM_HERE, 57 FROM_HERE,
(...skipping 12 matching lines...) Expand all
70 70
71 InfoBarService* infobar_service_; 71 InfoBarService* infobar_service_;
72 bool accept_; 72 bool accept_;
73 bool has_observed_; 73 bool has_observed_;
74 }; 74 };
75 } // namespace 75 } // namespace
76 76
77 class PushMessagingBrowserTest : public InProcessBrowserTest { 77 class PushMessagingBrowserTest : public InProcessBrowserTest {
78 public: 78 public:
79 PushMessagingBrowserTest() : gcm_service_(nullptr) {} 79 PushMessagingBrowserTest() : gcm_service_(nullptr) {}
80 virtual ~PushMessagingBrowserTest() {} 80 ~PushMessagingBrowserTest() override {}
81 81
82 // InProcessBrowserTest: 82 // InProcessBrowserTest:
83 virtual void SetUpCommandLine(base::CommandLine* command_line) override { 83 void SetUpCommandLine(base::CommandLine* command_line) override {
84 command_line->AppendSwitch( 84 command_line->AppendSwitch(
85 switches::kEnableExperimentalWebPlatformFeatures); 85 switches::kEnableExperimentalWebPlatformFeatures);
86 86
87 InProcessBrowserTest::SetUpCommandLine(command_line); 87 InProcessBrowserTest::SetUpCommandLine(command_line);
88 } 88 }
89 89
90 // InProcessBrowserTest: 90 // InProcessBrowserTest:
91 virtual void SetUp() override { 91 void SetUp() override {
92 https_server_.reset(new net::SpawnedTestServer( 92 https_server_.reset(new net::SpawnedTestServer(
93 net::SpawnedTestServer::TYPE_HTTPS, 93 net::SpawnedTestServer::TYPE_HTTPS,
94 net::BaseTestServer::SSLOptions( 94 net::BaseTestServer::SSLOptions(
95 net::BaseTestServer::SSLOptions::CERT_OK), 95 net::BaseTestServer::SSLOptions::CERT_OK),
96 base::FilePath(FILE_PATH_LITERAL("chrome/test/data/")))); 96 base::FilePath(FILE_PATH_LITERAL("chrome/test/data/"))));
97 ASSERT_TRUE(https_server_->Start()); 97 ASSERT_TRUE(https_server_->Start());
98 98
99 InProcessBrowserTest::SetUp(); 99 InProcessBrowserTest::SetUp();
100 } 100 }
101 101
102 // InProcessBrowserTest: 102 // InProcessBrowserTest:
103 virtual void SetUpOnMainThread() override { 103 void SetUpOnMainThread() override {
104 gcm_service_ = static_cast<FakeGCMProfileService*>( 104 gcm_service_ = static_cast<FakeGCMProfileService*>(
105 GCMProfileServiceFactory::GetInstance()->SetTestingFactoryAndUse( 105 GCMProfileServiceFactory::GetInstance()->SetTestingFactoryAndUse(
106 browser()->profile(), &FakeGCMProfileService::Build)); 106 browser()->profile(), &FakeGCMProfileService::Build));
107 gcm_service_->set_collect(true); 107 gcm_service_->set_collect(true);
108 108
109 loadTestPage(); 109 loadTestPage();
110 110
111 InProcessBrowserTest::SetUpOnMainThread(); 111 InProcessBrowserTest::SetUpOnMainThread();
112 } 112 }
113 113
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 GCMClient::IncomingMessage message; 194 GCMClient::IncomingMessage message;
195 GCMClient::MessageData messageData; 195 GCMClient::MessageData messageData;
196 messageData.insert(std::pair<std::string, std::string>("data", "testdata")); 196 messageData.insert(std::pair<std::string, std::string>("data", "testdata"));
197 message.data = messageData; 197 message.data = messageData;
198 push_service()->OnMessage(app_id.ToString(), message); 198 push_service()->OnMessage(app_id.ToString(), message);
199 ASSERT_TRUE(RunScript("pushData.get()", &script_result)); 199 ASSERT_TRUE(RunScript("pushData.get()", &script_result));
200 EXPECT_EQ("testdata", script_result); 200 EXPECT_EQ("testdata", script_result);
201 } 201 }
202 202
203 } // namespace gcm 203 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698