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