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

Unified Diff: chrome/browser/cocoa/keyword_editor_cocoa_controller_unittest.mm

Issue 193040: [Mac] Implement the search engine manager (Closed)
Patch Set: Final patch Created 11 years, 3 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/browser/cocoa/keyword_editor_cocoa_controller_unittest.mm
diff --git a/chrome/browser/cocoa/keyword_editor_cocoa_controller_unittest.mm b/chrome/browser/cocoa/keyword_editor_cocoa_controller_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..dcbe691ce7bfad63a1a7cab0237e28333abf7189
--- /dev/null
+++ b/chrome/browser/cocoa/keyword_editor_cocoa_controller_unittest.mm
@@ -0,0 +1,52 @@
+// Copyright (c) 2009 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 "base/scoped_nsobject.h"
+#include "chrome/browser/browser.h"
+#include "chrome/browser/cocoa/browser_test_helper.h"
+#include "chrome/browser/cocoa/cocoa_test_helper.h"
+#import "chrome/browser/cocoa/keyword_editor_cocoa_controller.h"
+#include "chrome/test/testing_profile.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/platform_test.h"
+
+@interface FakeKeywordEditorController : KeywordEditorCocoaController {
+ @public
+ BOOL changed_;
+}
+- (KeywordEditorModelObserver*)observer;
+@end
+
+@implementation FakeKeywordEditorController
+- (void)modelChanged {
+ changed_ = YES;
+}
+- (KeywordEditorModelObserver*)observer {
+ return observer_.get();
+}
+@end
+
+// TODO(rsesek): Figure out a good way to test this class (crbug.com/21640).
+
+class KeywordEditorCocoaControllerTest : public PlatformTest {
+ public:
+ void SetUp() {
+ TestingProfile* profile =
+ static_cast<TestingProfile*>(browser_helper_.profile());
+ profile->CreateTemplateURLModel();
+ controller_.reset(
+ [[FakeKeywordEditorController alloc] initWithProfile:profile]);
+ }
+
+ CocoaTestHelper cocoa_helper_;
+ BrowserTestHelper browser_helper_;
+ scoped_nsobject<FakeKeywordEditorController> controller_;
+};
+
+TEST_F(KeywordEditorCocoaControllerTest, TestModelChanged) {
+ EXPECT_FALSE(controller_.get()->changed_);
+ KeywordEditorModelObserver* observer = [controller_ observer];
+ observer->OnTemplateURLModelChanged();
+ EXPECT_TRUE(controller_.get()->changed_);
+}
« no previous file with comments | « chrome/browser/cocoa/keyword_editor_cocoa_controller.mm ('k') | chrome/browser/cocoa/preferences_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698