| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "chrome/browser/extensions/webstore_installer.h" | 8 #include "chrome/browser/extensions/webstore_installer.h" |
| 9 #include "chrome/common/omaha_query_params/omaha_query_params.h" | 9 #include "chrome/common/omaha_query_params/omaha_query_params.h" |
| 10 #include "extensions/common/id_util.h" | 10 #include "extensions/common/id_util.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 using base::StringPrintf; | 13 using base::StringPrintf; |
| 14 using chrome::OmahaQueryParams; | 14 using chrome::OmahaQueryParams; |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 // Returns true if |target| is found in |source|. | 18 // Returns true if |target| is found in |source|. |
| 19 bool Contains(const std::string& source, const std::string& target) { | 19 bool Contains(const std::string& source, const std::string& target) { |
| 20 return source.find(target) != std::string::npos; | 20 return source.find(target) != std::string::npos; |
| 21 } | 21 } |
| 22 | 22 |
| 23 TEST(WebstoreInstallerTest, PlatformParams) { | 23 TEST(WebstoreInstallerTest, PlatformParams) { |
| 24 std::string id = extensions::id_util::GenerateId("some random string"); | 24 std::string id = extensions::id_util::GenerateId("some random string"); |
| 25 GURL url = WebstoreInstaller::GetWebstoreInstallURL(id, ""); | 25 GURL url = WebstoreInstaller::GetWebstoreInstallURL(id, ""); |
| 26 std::string query = url.query(); | 26 std::string query = url.query(); |
| 27 EXPECT_TRUE(Contains(query,StringPrintf("os=%s", OmahaQueryParams::getOS()))); | 27 EXPECT_TRUE(Contains(query,StringPrintf("os=%s", OmahaQueryParams::getOS()))); |
| 28 EXPECT_TRUE(Contains(query,StringPrintf("arch=%s", | 28 EXPECT_TRUE(Contains(query,StringPrintf("arch=%s", |
| 29 OmahaQueryParams::getArch()))); | 29 OmahaQueryParams::getArch()))); |
| 30 EXPECT_TRUE(Contains(query,StringPrintf("nacl_arch=%s", | 30 EXPECT_TRUE(Contains(query,StringPrintf("nacl_arch=%s", |
| 31 OmahaQueryParams::getNaclArch()))); | 31 OmahaQueryParams::getNaclArch()))); |
| 32 | 32 |
| 33 } | 33 } |
| 34 | 34 |
| 35 } // namespace extensions | 35 } // namespace extensions |
| OLD | NEW |