| Index: chrome/browser/ui/webui/log_web_ui_url_browsertest.cc
|
| diff --git a/chrome/browser/ui/webui/log_web_ui_url_browsertest.cc b/chrome/browser/ui/webui/log_web_ui_url_browsertest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4eb3d9aaae6dd9a31190a4c9ecccc2cfd73a9f78
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/webui/log_web_ui_url_browsertest.cc
|
| @@ -0,0 +1,57 @@
|
| +// Copyright 2015 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/browser/ui/webui/log_web_ui_url.h"
|
| +
|
| +#include <vector>
|
| +
|
| +#include "base/bind.h"
|
| +#include "base/bind_helpers.h"
|
| +#include "base/callback.h"
|
| +#include "chrome/browser/ui/browser.h"
|
| +#include "chrome/browser/ui/browser_commands.h"
|
| +#include "chrome/common/url_constants.h"
|
| +#include "chrome/test/base/in_process_browser_test.h"
|
| +#include "chrome/test/base/ui_test_utils.h"
|
| +#include "url/gurl.h"
|
| +
|
| +namespace webui {
|
| +
|
| +class LogWebUIUrlTest : public InProcessBrowserTest {
|
| + public:
|
| + LogWebUIUrlTest() {
|
| + SetHashFunctionForTesting(
|
| + base::Bind(&LogWebUIUrlTest::Hash, base::Unretained(this)));
|
| + }
|
| +
|
| + ~LogWebUIUrlTest() override {
|
| + SetHashFunctionForTesting(WebUIUrlHash());
|
| + }
|
| +
|
| + const std::vector<GURL>& logged_urls() { return logged_urls_; }
|
| +
|
| + private:
|
| + uint32 Hash(const GURL& web_ui_url) {
|
| + logged_urls_.push_back(web_ui_url);
|
| + return 0;
|
| + }
|
| +
|
| + std::vector<GURL> logged_urls_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(LogWebUIUrlTest);
|
| +};
|
| +
|
| +IN_PROC_BROWSER_TEST_F(LogWebUIUrlTest, ExtensionLoadAndSendPolicy) {
|
| + ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL));
|
| + EXPECT_EQ(1U, logged_urls().size());
|
| + EXPECT_EQ(GURL("chrome://downloads"), logged_urls()[0]);
|
| +
|
| + chrome::Reload(browser(), CURRENT_TAB);
|
| + EXPECT_EQ(2U, logged_urls().size());
|
| + EXPECT_EQ(GURL("chrome://downloads"), logged_urls()[1]);
|
| +}
|
| +
|
| +// TODO(dbeam): test an uber page URL like chrome://history.
|
| +
|
| +} // namespace webui
|
|
|