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

Side by Side Diff: services/navigation/navigation_unittest.cc

Issue 1981623002: Add a basic browser to mash that uses the navigation service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <memory> 5 #include <memory>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "services/navigation/public/interfaces/view.mojom.h" 9 #include "services/navigation/public/interfaces/view.mojom.h"
10 #include "services/shell/public/cpp/shell_client.h" 10 #include "services/shell/public/cpp/shell_client.h"
(...skipping 23 matching lines...) Expand all
34 loop_ = loop; 34 loop_ = loop;
35 } 35 }
36 36
37 private: 37 private:
38 // mojom::ViewClient: 38 // mojom::ViewClient:
39 void LoadingStateChanged(bool is_loading) override { 39 void LoadingStateChanged(bool is_loading) override {
40 // Should see loading start, then stop. 40 // Should see loading start, then stop.
41 if (++load_count_ == 2 && loop_) 41 if (++load_count_ == 2 && loop_)
42 loop_->Quit(); 42 loop_->Quit();
43 } 43 }
44 void NavigationStateChanged(const GURL& url,
45 const mojo::String& title,
46 bool can_go_back,
47 bool can_go_forward) override {}
48 void LoadProgressChanged(double progress) override {}
49 void ViewCreated(mojom::ViewPtr, mojom::ViewClientRequest, bool,
50 mojo::RectPtr, bool) override {}
51 void Close() override {}
44 52
45 int load_count_ = 0; 53 int load_count_ = 0;
46 mojo::Binding<mojom::ViewClient> binding_; 54 mojo::Binding<mojom::ViewClient> binding_;
47 base::RunLoop* loop_ = nullptr; 55 base::RunLoop* loop_ = nullptr;
48 std::unique_ptr<shell::Connection> window_manager_connection_; 56 std::unique_ptr<shell::Connection> window_manager_connection_;
49 57
50 DISALLOW_COPY_AND_ASSIGN(NavigationTest); 58 DISALLOW_COPY_AND_ASSIGN(NavigationTest);
51 }; 59 };
52 60
53 TEST_F(NavigationTest, LoadURL) { 61 TEST_F(NavigationTest, Navigate) {
54 mojom::ViewFactoryPtr view_factory; 62 mojom::ViewFactoryPtr view_factory;
55 connector()->ConnectToInterface("exe:navigation", &view_factory); 63 connector()->ConnectToInterface("exe:navigation", &view_factory);
56 64
57 mojom::ViewPtr view; 65 mojom::ViewPtr view;
58 view_factory->CreateView(GetViewClient(), GetProxy(&view)); 66 view_factory->CreateView(GetViewClient(), GetProxy(&view));
59 view->LoadUrl(GURL("about:blank")); 67 view->NavigateTo(GURL("about:blank"));
60 68
61 base::RunLoop loop; 69 base::RunLoop loop;
62 QuitOnLoadingStateChange(&loop); 70 QuitOnLoadingStateChange(&loop);
63 loop.Run(); 71 loop.Run();
64 } 72 }
65 73
66 } // namespace navigation 74 } // namespace navigation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698