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

Side by Side Diff: blimp/client/core/contents/blimp_contents_impl_unittest.cc

Issue 2201433002: Migrate TabControlFeature from 0.5 to 0.6 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove BlmipContentImpl default constructor, Move BlimpContentsDeletionObserver declaration to blim… Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "blimp/client/core/contents/blimp_contents_impl.h" 5 #include "blimp/client/core/contents/blimp_contents_impl.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "blimp/client/core/contents/blimp_contents_impl.h" 8 #include "blimp/client/core/contents/blimp_contents_impl.h"
9 #include "blimp/client/public/contents/blimp_contents_observer.h" 9 #include "blimp/client/public/contents/blimp_contents_observer.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace blimp { 12 namespace blimp {
13 namespace client { 13 namespace client {
14 namespace { 14 namespace {
15 15
16 const GURL kExampleURL = GURL("https://www.example.com/"); 16 const GURL kExampleURL = GURL("https://www.example.com/");
17 const GURL kOtherExampleURL = GURL("https://www.otherexample.com/"); 17 const GURL kOtherExampleURL = GURL("https://www.otherexample.com/");
18 const int kDummyTabId = 0;
18 19
19 class TestBlimpContentsObserver : public BlimpContentsObserver { 20 class TestBlimpContentsObserver : public BlimpContentsObserver {
20 public: 21 public:
21 TestBlimpContentsObserver() = default; 22 TestBlimpContentsObserver() = default;
22 ~TestBlimpContentsObserver() override = default; 23 ~TestBlimpContentsObserver() override = default;
23 24
24 void OnURLUpdated(const GURL& url) override { last_url_ = url; } 25 void OnURLUpdated(const GURL& url) override { last_url_ = url; }
25 26
26 GURL GetLastURL() { return last_url_; } 27 GURL GetLastURL() { return last_url_; }
27 28
28 private: 29 private:
29 GURL last_url_; 30 GURL last_url_;
30 31
31 DISALLOW_COPY_AND_ASSIGN(TestBlimpContentsObserver); 32 DISALLOW_COPY_AND_ASSIGN(TestBlimpContentsObserver);
32 }; 33 };
33 34
34 TEST(BlimpContentsImplTest, Basic) { 35 TEST(BlimpContentsImplTest, Basic) {
35 base::MessageLoop loop; 36 base::MessageLoop loop;
36 BlimpContentsImpl blimp_contents; 37 BlimpContentsImpl blimp_contents{kDummyTabId};
37 38
38 BlimpNavigationController& navigation_controller = 39 BlimpNavigationController& navigation_controller =
39 blimp_contents.GetNavigationController(); 40 blimp_contents.GetNavigationController();
40 41
41 TestBlimpContentsObserver observer1; 42 TestBlimpContentsObserver observer1;
42 blimp_contents.AddObserver(&observer1); 43 blimp_contents.AddObserver(&observer1);
43 TestBlimpContentsObserver observer2; 44 TestBlimpContentsObserver observer2;
44 blimp_contents.AddObserver(&observer2); 45 blimp_contents.AddObserver(&observer2);
45 46
46 navigation_controller.LoadURL(kExampleURL); 47 navigation_controller.LoadURL(kExampleURL);
(...skipping 10 matching lines...) Expand all
57 loop.RunUntilIdle(); 58 loop.RunUntilIdle();
58 59
59 EXPECT_EQ(kOtherExampleURL, navigation_controller.GetURL()); 60 EXPECT_EQ(kOtherExampleURL, navigation_controller.GetURL());
60 EXPECT_EQ(kExampleURL, observer1.GetLastURL()); 61 EXPECT_EQ(kExampleURL, observer1.GetLastURL());
61 EXPECT_EQ(kOtherExampleURL, observer2.GetLastURL()); 62 EXPECT_EQ(kOtherExampleURL, observer2.GetLastURL());
62 } 63 }
63 64
64 } // namespace 65 } // namespace
65 } // namespace client 66 } // namespace client
66 } // namespace blimp 67 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698