| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/string16.h" | 7 #include "base/string16.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/api/push_messaging/sync_setup_helper.h" | 10 #include "chrome/browser/extensions/api/push_messaging/sync_setup_helper.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 sync_setup_helper_.reset(); | 86 sync_setup_helper_.reset(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void StartRunningTest() { | 89 void StartRunningTest() { |
| 90 // Get the credentials from the setup helper. | 90 // Get the credentials from the setup helper. |
| 91 const std::string& client_id = sync_setup_helper_->client_id(); | 91 const std::string& client_id = sync_setup_helper_->client_id(); |
| 92 const std::string& client_secret = sync_setup_helper_->client_secret(); | 92 const std::string& client_secret = sync_setup_helper_->client_secret(); |
| 93 const std::string& refresh_token = sync_setup_helper_->refresh_token(); | 93 const std::string& refresh_token = sync_setup_helper_->refresh_token(); |
| 94 | 94 |
| 95 // Construct a JS string to pass in the parameters and start the test. | 95 // Construct a JS string to pass in the parameters and start the test. |
| 96 std::string script_string = StringPrintf( | 96 std::string script_string = base::StringPrintf( |
| 97 "startTestWithCredentials('%s', '%s', '%s');", | 97 "startTestWithCredentials('%s', '%s', '%s');", |
| 98 client_id.c_str(), client_secret.c_str(), refresh_token.c_str()); | 98 client_id.c_str(), client_secret.c_str(), refresh_token.c_str()); |
| 99 string16 script16 = UTF8ToUTF16(script_string); | 99 string16 script16 = UTF8ToUTF16(script_string); |
| 100 | 100 |
| 101 browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost()-> | 101 browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost()-> |
| 102 ExecuteJavascriptInWebFrame(string16(), script16); | 102 ExecuteJavascriptInWebFrame(string16(), script16); |
| 103 } | 103 } |
| 104 | 104 |
| 105 protected: | 105 protected: |
| 106 // Override InProcessBrowserTest. Change behavior of the default host | 106 // Override InProcessBrowserTest. Change behavior of the default host |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 DVLOG(1) << "push_canary app done loading"; | 175 DVLOG(1) << "push_canary app done loading"; |
| 176 | 176 |
| 177 StartRunningTest(); | 177 StartRunningTest(); |
| 178 | 178 |
| 179 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 179 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 180 | 180 |
| 181 LOG(INFO) << "Exiting Push Messaging Canary test"; | 181 LOG(INFO) << "Exiting Push Messaging Canary test"; |
| 182 } | 182 } |
| 183 | 183 |
| 184 } // namespace extensions | 184 } // namespace extensions |
| OLD | NEW |