root/chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. TEST_F

// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
#include "chrome/common/extensions/manifest_url_handler.h"
#include "extensions/common/manifest_constants.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace errors = extensions::manifest_errors;

class URLOverridesManifestTest : public ExtensionManifestTest {
};

TEST_F(URLOverridesManifestTest, Override) {
  Testcase testcases[] = {
    Testcase("override_newtab_and_history.json", errors::kMultipleOverrides),
    Testcase("override_invalid_page.json", errors::kInvalidChromeURLOverrides)
  };
  RunTestcases(testcases, arraysize(testcases),
               EXPECT_TYPE_ERROR);

  scoped_refptr<extensions::Extension> extension;

  extension = LoadAndExpectSuccess("override_new_tab.json");
  EXPECT_EQ(extension->url().spec() + "newtab.html",
            extensions::URLOverrides::GetChromeURLOverrides(extension.get())
                .find("newtab")->second.spec());

  extension = LoadAndExpectSuccess("override_history.json");
  EXPECT_EQ(extension->url().spec() + "history.html",
            extensions::URLOverrides::GetChromeURLOverrides(extension.get())
                .find("history")->second.spec());
}

/* [<][>][^][v][top][bottom][index][help] */