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

Unified Diff: ios/chrome/browser/ui/ntp/google_landing_controller_unittest.mm

Issue 2590473002: Upstream Chrome on iOS source code [5/11]. (Closed)
Patch Set: Created 4 years 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: ios/chrome/browser/ui/ntp/google_landing_controller_unittest.mm
diff --git a/ios/chrome/browser/ui/ntp/google_landing_controller_unittest.mm b/ios/chrome/browser/ui/ntp/google_landing_controller_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..cd02478f8b8217a7518f07c29185a7a8b292c99a
--- /dev/null
+++ b/ios/chrome/browser/ui/ntp/google_landing_controller_unittest.mm
@@ -0,0 +1,75 @@
+// Copyright 2013 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 <memory>
+
+#include "base/mac/scoped_nsobject.h"
+#include "base/memory/ptr_util.h"
+#include "base/message_loop/message_loop.h"
+#include "components/search_engines/template_url_service.h"
+#include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
+#include "ios/chrome/browser/search_engines/template_url_service_factory.h"
+#include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h"
+#import "ios/chrome/browser/ui/ntp/google_landing_controller.h"
+#include "ios/chrome/test/block_cleanup_test.h"
+#include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h"
+#include "ios/web/public/test/test_web_thread.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/gtest_mac.h"
+#import "third_party/ocmock/OCMock/OCMock.h"
+
+namespace {
+
+class GoogleLandingControllerTest : public BlockCleanupTest {
+ public:
+ GoogleLandingControllerTest()
+ : ui_thread_(web::WebThread::UI, &message_loop_),
+ io_thread_(web::WebThread::IO, &message_loop_) {}
+
+ protected:
+ void SetUp() override {
+ DCHECK_CURRENTLY_ON(web::WebThread::UI);
+
+ TestChromeBrowserState::Builder test_cbs_builder;
+ test_cbs_builder.AddTestingFactory(
+ IOSChromeTabRestoreServiceFactory::GetInstance(),
+ IOSChromeTabRestoreServiceFactory::GetDefaultFactory());
+ test_cbs_builder.AddTestingFactory(
+ ios::TemplateURLServiceFactory::GetInstance(),
+ ios::TemplateURLServiceFactory::GetDefaultFactory());
+
+ chrome_browser_state_ = test_cbs_builder.Build();
+ BlockCleanupTest::SetUp();
+
+ // Set up tab restore service.
+ TemplateURLService* template_url_service =
+ ios::TemplateURLServiceFactory::GetForBrowserState(
+ chrome_browser_state_.get());
+ template_url_service->Load();
+
+ // Set up stub UrlLoader.
+ mockUrlLoader_.reset(
+ [[OCMockObject mockForProtocol:@protocol(UrlLoader)] retain]);
+ controller_.reset([[GoogleLandingController alloc]
+ initWithLoader:(id<UrlLoader>)mockUrlLoader_.get()
+ browserState:chrome_browser_state_.get()
+ focuser:nil
+ webToolbarDelegate:nil
+ tabModel:nil]);
+ };
+
+ base::MessageLoopForUI message_loop_;
+ web::TestWebThread ui_thread_;
+ web::TestWebThread io_thread_;
+ IOSChromeScopedTestingLocalState local_state_;
+ std::unique_ptr<TestChromeBrowserState> chrome_browser_state_;
+ base::scoped_nsobject<OCMockObject> mockUrlLoader_;
+ base::scoped_nsobject<GoogleLandingController> controller_;
+};
+
+TEST_F(GoogleLandingControllerTest, TestConstructorDestructor) {
+ EXPECT_TRUE(controller_.get());
+}
+
+} // anonymous namespace
« no previous file with comments | « ios/chrome/browser/ui/ntp/google_landing_controller.mm ('k') | ios/chrome/browser/ui/ntp/incognito_panel_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698