Chromium Code Reviews| 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/strings/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/browser/omaha_query_params/omaha_query_params.h" |
| 10 #include "extensions/common/id_util.h" | 10 #include "extensions/common/id_util.h" |
| 11 #include "net/base/escape.h" | 11 #include "net/base/escape.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 using base::StringPrintf; | 14 using base::StringPrintf; |
| 15 using chrome::OmahaQueryParams; | 15 using chrome::OmahaQueryParams; |
| 16 | 16 |
| 17 namespace extensions { | 17 namespace extensions { |
| 18 | 18 |
| 19 // Returns true if |target| is found in |source|. | 19 // Returns true if |target| is found in |source|. |
| 20 bool Contains(const std::string& source, const std::string& target) { | 20 bool Contains(const std::string& source, const std::string& target) { |
| 21 return source.find(target) != std::string::npos; | 21 return source.find(target) != std::string::npos; |
| 22 } | 22 } |
| 23 | 23 |
| 24 TEST(WebstoreInstallerTest, PlatformParams) { | 24 TEST(WebstoreInstallerTest, PlatformParams) { |
|
Sorin Jianu
2014/02/13 19:06:55
Should this test be updated to include the lang qu
Devlin
2014/02/14 00:26:42
Done.
| |
| 25 std::string id = extensions::id_util::GenerateId("some random string"); | 25 std::string id = extensions::id_util::GenerateId("some random string"); |
| 26 std::string source = "inline"; | 26 std::string source = "inline"; |
| 27 GURL url = WebstoreInstaller::GetWebstoreInstallURL(id, | 27 GURL url = WebstoreInstaller::GetWebstoreInstallURL(id, |
| 28 WebstoreInstaller::INSTALL_SOURCE_INLINE); | 28 WebstoreInstaller::INSTALL_SOURCE_INLINE); |
| 29 std::string query = url.query(); | 29 std::string query = url.query(); |
| 30 EXPECT_TRUE(Contains(query,StringPrintf("os=%s", OmahaQueryParams::getOS()))); | 30 EXPECT_TRUE(Contains(query,StringPrintf("os=%s", OmahaQueryParams::getOS()))); |
| 31 EXPECT_TRUE(Contains(query,StringPrintf("arch=%s", | 31 EXPECT_TRUE(Contains(query,StringPrintf("arch=%s", |
| 32 OmahaQueryParams::getArch()))); | 32 OmahaQueryParams::getArch()))); |
| 33 EXPECT_TRUE(Contains(query,StringPrintf("nacl_arch=%s", | 33 EXPECT_TRUE(Contains(query,StringPrintf("nacl_arch=%s", |
| 34 OmahaQueryParams::getNaclArch()))); | 34 OmahaQueryParams::getNaclArch()))); |
| 35 EXPECT_TRUE(Contains(query,net::EscapeQueryParamValue( | 35 EXPECT_TRUE(Contains(query,net::EscapeQueryParamValue( |
| 36 StringPrintf("installsource=%s", source.c_str()), | 36 StringPrintf("installsource=%s", source.c_str()), |
| 37 true))); | 37 true))); |
| 38 } | 38 } |
| 39 | 39 |
| 40 } // namespace extensions | 40 } // namespace extensions |
| OLD | NEW |