Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6059)

Unified Diff: chrome/test/data/webui/assertions-inl.h

Issue 7250009: Added guts to pull call signatures when assertions & expectations fail. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include constructed messages instead of just call signature. Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/assertions-inl.h
diff --git a/chrome/test/data/webui/assertions-inl.h b/chrome/test/data/webui/assertions-inl.h
new file mode 100644
index 0000000000000000000000000000000000000000..d0263b7857223982ed59ed442450cd70612c80c9
--- /dev/null
+++ b/chrome/test/data/webui/assertions-inl.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2011 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/chrome_web_ui.h"
+#include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h"
+#include "googleurl/src/gurl.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+using ::testing::_;
+using ::testing::Eq;
+using ::testing::StrictMock;
+
+// Dummy URL location for us to override.
+const char kDummyURL[] = "chrome://DummyURL/";
+
+// Returns a new WebUI object for the TabContents from |arg0|.
+ACTION(ReturnNewWebUI) {
+ return new ChromeWebUI(arg0);
+}
+
+// Mock the TestChromeWebUIFactory::WebUIProvider to prove that we are called as
+// expected.
+class MockWebUIProvider : public TestChromeWebUIFactory::WebUIProvider {
+ public:
+ MOCK_METHOD2(NewWebUI, WebUI*(TabContents* tab_contents, const GURL& url));
+};
+
+class WebUIAssertionsTest : public WebUIBrowserTest {
+ public:
+ virtual void SetUpOnMainThread() OVERRIDE {
+ WebUIBrowserTest::SetUpOnMainThread();
+ TestChromeWebUIFactory::AddFactoryOverride(
+ GURL(kDummyURL).host(), &mock_provider_);
+ EXPECT_CALL(mock_provider_, NewWebUI(_, Eq(GURL(kDummyURL))))
+ .WillOnce(ReturnNewWebUI());
+ }
+ virtual void CleanUpOnMainThread() OVERRIDE {
+ WebUIBrowserTest::CleanUpOnMainThread();
+ TestChromeWebUIFactory::RemoveFactoryOverride(
+ GURL(kDummyURL).host());
+ }
+
+ StrictMock<MockWebUIProvider> mock_provider_;
+
+};

Powered by Google App Engine
This is Rietveld 408576698